diff mbox

[2/2] iw: fix memory leak

Message ID 1411237525-5810-2-git-send-email-yegorslists@googlemail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Yegor Yefremov Sept. 20, 2014, 6:25 p.m. UTC
Close f, when returning before while loop.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 coalesce.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/coalesce.c b/coalesce.c
index 0239915..0d80ceb 100644
--- a/coalesce.c
+++ b/coalesce.c
@@ -38,8 +38,10 @@  static int handle_coalesce_enable(struct nl80211_state *state, struct nl_cb *cb,
 		return 1;
 
 	nl_rules = nla_nest_start(msg, NL80211_ATTR_COALESCE_RULE);
-	if (!nl_rules)
+	if (!nl_rules) {
+		fclose(f);
 		return -ENOBUFS;
+	}
 
 	while (!feof(f)) {
 		char *eol;