Search Linux Wireless

[PATCH] iw: Fix memory leak in error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The leak is present if malloc fails after requesting
a scan with ies or meshid as input.

Signed-off-by: Ola Olsson <ola.olsson@xxxxxxxxxxxxxx>
---
 scan.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scan.c b/scan.c
index 8197679..d3c7d98 100644
--- a/scan.c
+++ b/scan.c
@@ -446,8 +446,11 @@ static int handle_scan(struct nl80211_state *state,
 
 	if (ies || meshid) {
 		tmpies = (unsigned char *) malloc(ies_len + meshid_len);
-		if (!tmpies)
+		if (!tmpies) {
+			free(ies);
+			free(meshid);
 			goto nla_put_failure;
+		}
 		if (ies) {
 			memcpy(tmpies, ies, ies_len);
 			free(ies);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux