aboutsummaryrefslogtreecommitdiffstats
path: root/caputils/ws80211_utils.c
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@gmail.com>2016-01-12 16:50:37 +0100
committerAnders Broman <a.broman58@gmail.com>2016-01-13 07:35:19 +0000
commitfda44fa1fd70cec4b47e11c959b2e04d62ebc0ce (patch)
tree02e233f717413bcb2ba81d44b1dc6e971e8306b1 /caputils/ws80211_utils.c
parent1f0c9f669375da29c60552ce2f7a63c9bfbd1433 (diff)
Fix some memory leaks in ws80211_utils
Valgrind report memleaks like these when using the wireless toolbar to create a monitor interface and/or changing channel: 4,168 (72 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 31 of 32 at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5BD0742: ??? (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) by 0x116308: ws80211_create_on_demand_interface (ws80211_utils.c:699) by 0x116308: ws80211_set_freq (ws80211_utils.c:729) by 0x10D70E: set_80211_channel (dumpcap.c:4262) by 0x10D70E: main (dumpcap.c:4935) 4,168 (72 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 32 of 32 at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5BD0742: ??? (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) by 0x116400: ws80211_set_freq (ws80211_utils.c:733) by 0x10D70E: set_80211_channel (dumpcap.c:4262) by 0x10D70E: main (dumpcap.c:4935) Change-Id: Ia1de630859d96653310fbb3efebdc439ebf107b8 Reviewed-on: https://code.wireshark.org/review/13237 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'caputils/ws80211_utils.c')
-rw-r--r--caputils/ws80211_utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/caputils/ws80211_utils.c b/caputils/ws80211_utils.c
index a83f5365a2..e374372fff 100644
--- a/caputils/ws80211_utils.c
+++ b/caputils/ws80211_utils.c
@@ -710,11 +710,13 @@ static int ws80211_create_on_demand_interface(const char *name)
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, NL80211_IFTYPE_MONITOR);
err = nl80211_do_cmd(msg, cb);
+ nlmsg_free(msg);
if (err)
return err;
return ws80211_iface_up(name);
nla_put_failure:
+ nlmsg_free(msg);
fprintf(stderr, "building message failed\n");
return 2;
}
@@ -775,9 +777,11 @@ int ws80211_set_freq(const char *name, int freq, int chan_type)
break;
}
err = nl80211_do_cmd(msg, cb);
+ nlmsg_free(msg);
return err;
nla_put_failure:
+ nlmsg_free(msg);
fprintf(stderr, "building message failed\n");
return 2;