From: Ola Olsson Date: Fri, 9 Oct 2015 14:52:42 +0000 (+0200) Subject: iw: Fix memory leak in error path X-Git-Tag: v4.7~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24cc1cf4c0f2995b7a08f3807ce5345ce2c338ff;p=thirdparty%2Fiw.git iw: Fix memory leak in error path The leak is present if malloc fails after requesting a scan with ies or meshid as input. Signed-off-by: Ola Olsson Signed-off-by: Johannes Berg --- 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);