From: lixiaokeng Subject: [PATCH V2 05/14] multipathd: use MALLOC and check return value in cli_getprkey func Date: Tue, 8 Sep 2020 14:57:59 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Content-Language: en-GB To: Christophe Varoqui , Martin Wilck , Benjamin Marzinski Cc: linfeilong , dm-devel mailing list , "liuzhiqiang (I)" List-Id: dm-devel.ids In cli_getprkey func, we use MALLOC instead of malloc, and check the return value of MALLOC. V1->V2: turn back MALLOC to malloc and reomve error message Signed-off-by: Zhiqiang Liu Signed-off-by: Lixiaokeng Signed-off-by: Linfeilong --- multipathd/cli_handlers.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index e9698704..235e2a2e 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -1531,6 +1531,8 @@ cli_getprkey(void * v, char ** reply, int * len, void * data) return 1; *reply = malloc(26); + if (!*reply) + return 1; if (!get_be64(mpp->reservation_key)) { sprintf(*reply, "none\n"); --