From patchwork Wed Jan 6 16:35:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 71361 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o06HaD8u005566 for ; Wed, 6 Jan 2010 17:36:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932481Ab0AFRgI (ORCPT ); Wed, 6 Jan 2010 12:36:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932408Ab0AFRgB (ORCPT ); Wed, 6 Jan 2010 12:36:01 -0500 Received: from smtp.mujha-vel.cz ([81.30.225.246]:47610 "EHLO smtp.mujha-vel.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932407Ab0AFRf6 (ORCPT ); Wed, 6 Jan 2010 12:35:58 -0500 Received: from [217.66.174.142] (helo=localhost.localdomain) by smtp.mujha-vel.cz with esmtp (Exim 4.63) (envelope-from ) id 1NSYrJ-0005dw-FV; Wed, 06 Jan 2010 17:35:45 +0100 From: Jiri Slaby To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] NET: wireless, fix memory leak Date: Wed, 6 Jan 2010 17:35:43 +0100 Message-Id: <1262795743-15009-2-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 1.6.5.7 In-Reply-To: <1262795743-15009-1-git-send-email-jslaby@suse.cz> References: <1262795743-15009-1-git-send-email-jslaby@suse.cz> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 9c50c85..3003d13 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -685,7 +685,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, /* No channels found? */ if (!i) { err = -EINVAL; - goto out; + goto out_free; } /* Set real number of channels specified in creq->channels[] */ @@ -696,7 +696,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) { err = -EINVAL; - goto out; + goto out_free; } memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); creq->ssids[0].ssid_len = wreq->essid_len; @@ -717,6 +717,9 @@ int cfg80211_wext_siwscan(struct net_device *dev, out: cfg80211_unlock_rdev(rdev); return err; +out_free: + kfree(creq); + goto out; } EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan);