]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - mgmt.c
scan: wps: fix some misplaced code
[thirdparty/iw.git] / mgmt.c
diff --git a/mgmt.c b/mgmt.c
index 60f544b0b1c1b5a1f4c273e973d68fea70ad0361..338435d41d0e5e76907618d82ddfdec08592194a 100644 (file)
--- a/mgmt.c
+++ b/mgmt.c
@@ -69,9 +69,11 @@ static int register_mgmt_frame(struct nl80211_state *state,
        NLA_PUT_U16(msg, NL80211_ATTR_FRAME_TYPE, type);
        NLA_PUT(msg, NL80211_ATTR_FRAME_MATCH, match_len, match);
 
+       free(match);
        return 0;
 
 nla_put_failure:
+       free(match);
        return -ENOBUFS;
 }
 
@@ -107,6 +109,8 @@ static int handle_mgmt_dump(struct nl80211_state *state,
        for (i = 3; i < argc; i += 3) {
                if (strcmp(argv[i], "count") == 0) {
                        count = 1 + atoi(argv[i + 1]);
+                       if (count < 1)
+                               count = 1;
                        break;
                }