From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932511AbcIBPpR (ORCPT ); Fri, 2 Sep 2016 11:45:17 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:61563 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932236AbcIBPpP (ORCPT ); Fri, 2 Sep 2016 11:45:15 -0400 X-IronPort-AV: E=Sophos;i="5.30,271,1470726000"; d="scan'208";a="221549665" X-IronPort-AV: E=McAfee;i="5700,7163,8276"; a="1211272795" X-Amp-Result: CLEAN From: "Valo, Kalle" To: Colin King CC: "ath10k@lists.infradead.org" , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] ath10k: fix memory leak on caldata on error exit path Thread-Topic: [PATCH] ath10k: fix memory leak on caldata on error exit path Thread-Index: AQHR9wlcK4Oo/0z3vEiY54Mp81XZyg== Date: Fri, 2 Sep 2016 15:45:09 +0000 Message-ID: <87r392z4ox.fsf@kamboji.qca.qualcomm.com> References: <1471268785-11576-1-git-send-email-colin.king@canonical.com> In-Reply-To: <1471268785-11576-1-git-send-email-colin.king@canonical.com> (Colin King's message of "Mon, 15 Aug 2016 14:46:25 +0100") Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.251.52.12] Content-Type: text/plain; charset="us-ascii" Content-ID: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id u82FjiHL020761 Colin King writes: > From: Colin Ian King > > caldata is not being free'd on the error exit path, causing > a memory leak. kfree it to fix the leak. > > Signed-off-by: Colin Ian King > --- > drivers/net/wireless/ath/ath10k/pci.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c > index 9a22c47..886337c 100644 > --- a/drivers/net/wireless/ath/ath10k/pci.c > +++ b/drivers/net/wireless/ath/ath10k/pci.c > @@ -2725,6 +2725,7 @@ static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data, > return 0; > > err_free: > + kfree(caldata); > kfree(data); > > return -EINVAL; I don't think we should free data at all: static int ath10k_download_cal_eeprom(struct ath10k *ar) { size_t data_len; void *data = NULL; int ret; ret = ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len); Instead we should free only caldata, right? -- Kalle Valo