Return-path: Received: from esa5.microchip.iphmx.com ([216.71.150.166]:34176 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751777AbeCWPJa (ORCPT ); Fri, 23 Mar 2018 11:09:30 -0400 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 6/9] staging: wilc1000: fix to free allocated memory in wilc_add_ptk() Date: Fri, 23 Mar 2018 20:38:55 +0530 Message-ID: <1521817738-7557-7-git-send-email-ajay.kathat@microchip.com> (sfid-20180323_160933_676285_02EE4BB2) In-Reply-To: <1521817738-7557-1-git-send-email-ajay.kathat@microchip.com> References: <1521817738-7557-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org List-ID: Free allocated memory in wilc_add_ptk() when it fails to enqueue the command. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index f493c78..a8771d5 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2827,10 +2827,12 @@ int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, result = wilc_enqueue_cmd(&msg); - if (result) + if (result) { netdev_err(vif->ndev, "PTK Key\n"); - else + kfree(msg.body.key_info.attr.wpa.key); + } else { wait_for_completion(&hif_drv->comp_test_key_block); + } return result; } -- 2.7.4