From: Brian Norris Date: Thu, 21 Nov 2019 22:41:39 +0000 (-0800) Subject: iw: scan: fix double-free in error paths X-Git-Tag: v5.4~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e322f826cd7593c33b918ea5d9a097d4ff02c72;p=thirdparty%2Fiw.git iw: scan: fix double-free in error paths Hit when, for instance, I'm stupid enough to type an invalid scan command: # iw wlan0 scan -h BUG at file position lib/msg.c:572:void nlmsg_free(struct nl_msg *) iw: lib/msg.c:572: void nlmsg_free(struct nl_msg *): Assertion `0' failed. Aborted (core dumped) Fixes: 2f74c59cf11e ("iw: fix memory leaks inside handle_scan") Cc: John Crispin Signed-off-by: Brian Norris Link: https://lore.kernel.org/r/20191121224139.58281-1-briannorris@chromium.org Signed-off-by: Johannes Berg --- diff --git a/scan.c b/scan.c index 1418da7..bfd39e4 100644 --- a/scan.c +++ b/scan.c @@ -448,8 +448,6 @@ static int handle_scan(struct nl80211_state *state, } /* fall through - this is an error */ case DONE: - nlmsg_free(ssids); - nlmsg_free(freqs); err = 1; goto nla_put_failure; case FREQ: