aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-zbee-nwk.c
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2015-08-09 18:06:47 +0200
committerAnders Broman <a.broman58@gmail.com>2015-08-10 04:50:03 +0000
commitd108f2871c285646aa16f76bf635a36e096b9b05 (patch)
tree2fd779d826f37db3a386992dad9f21a079291446 /epan/dissectors/packet-zbee-nwk.c
parentc462f1b54ed4459c0c93dabbf5fe30f224e796a6 (diff)
zigbee: fix two memory leaks
==17992== 4 bytes in 1 blocks are definitely lost in loss record 68 of 4,102 ==17992== at 0x4C28BED: malloc (vg_replace_malloc.c:263) ==17992== by 0x9FB2F30: g_malloc (gmem.c:159) ==17992== by 0x9FC89E5: g_memdup (gstrfuncs.c:384) ==17992== by 0x703F977: dissect_zbee_aps (packet-zbee-aps.c:1300) ==17992== by 0x67B4F1E: call_dissector_through_handle (packet.c:618) ==17992== 8 bytes in 1 blocks are definitely lost in loss record 580 of 4,102 ==17992== at 0x4C272B8: calloc (vg_replace_malloc.c:566) ==17992== by 0x9FB2F88: g_malloc0 (gmem.c:189) ==17992== by 0x703F962: dissect_zbee_aps (packet-zbee-aps.c:1299) ==17992== by 0x67B4F1E: call_dissector_through_handle (packet.c:618) second version that uses glib memory routines and does not mix g_hash_table and wmem remove an obsolete comment and an unnecessary return; while at it Change-Id: I2e92db0613f01b6c3009e8ad82ceb65a87cba12e Reviewed-on: https://code.wireshark.org/review/9830 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-zbee-nwk.c')
-rw-r--r--epan/dissectors/packet-zbee-nwk.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c
index d0f72b92cf..eb9836bebb 100644
--- a/epan/dissectors/packet-zbee-nwk.c
+++ b/epan/dissectors/packet-zbee-nwk.c
@@ -1957,11 +1957,16 @@ void proto_reg_handoff_zbee_nwk(void)
zbee_security_handoff();
} /* proto_reg_handoff_zbee */
+static void free_keyring_key(gpointer key)
+{
+ g_free(key);
+}
+
static void free_keyring_val(gpointer a)
{
GSList **slist = (GSList **)a;
- g_slist_free(*slist);
- return;
+ g_slist_free_full(*slist, g_free);
+ g_free(slist);
}
/*FUNCTION:------------------------------------------------------
@@ -1983,7 +1988,7 @@ proto_init_zbee_nwk(void)
{
zbee_nwk_map.short_table = g_hash_table_new(ieee802154_short_addr_hash, ieee802154_short_addr_equal);
zbee_nwk_map.long_table = g_hash_table_new(ieee802154_long_addr_hash, ieee802154_long_addr_equal);
- zbee_table_nwk_keyring = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, free_keyring_val);
+ zbee_table_nwk_keyring = g_hash_table_new_full(g_int_hash, g_int_equal, free_keyring_key, free_keyring_val);
} /* proto_init_zbee_nwk */
static void