forked from osmocom/wireshark
zbee-nwk-gp: fix a memory leak when keys are defined in the preferences
==5932== 33 (32 direct, 1 indirect) bytes in 1 blocks are definitely lost in loss record 2,124 of 4,121 ==5932== at 0x4C28BED: malloc (vg_replace_malloc.c:263) ==5932== by 0xA024F30: g_malloc (gmem.c:159) ==5932== by 0xA03A9E5: g_memdup (gstrfuncs.c:384) ==5932== by 0x70754D2: gp_init_zbee_security (packet-zbee-nwk-gp.c:1459) ==5932== by 0xA03A78C: g_slist_foreach (gslist.c:840) ==5932== by 0x67E867C: init_dissection (packet.c:249) ==5932== by 0x67DC202: epan_new (epan.c:160) ==5932== by 0x414B16: cf_open (tshark.c:2464) ==5932== by 0x40CF8A: main (tshark.c:2169) Change-Id: I7c0ce0717957525ca18eb4888ed3389debc89a49 Reviewed-on: https://code.wireshark.org/review/9967 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>
This commit is contained in:
parent
b1be6bce66
commit
56a9b53773
|
@ -1460,13 +1460,28 @@ gp_init_zbee_security(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void zbee_free_key_record(gpointer ptr, gpointer user_data _U_)
|
||||
{
|
||||
key_record_t *k;
|
||||
|
||||
k = (key_record_t *)ptr;
|
||||
if (!k)
|
||||
return;
|
||||
|
||||
g_free(k->label);
|
||||
g_free(k);
|
||||
}
|
||||
|
||||
static void
|
||||
gp_cleanup_zbee_security(void)
|
||||
{
|
||||
if (zbee_gp_keyring) {
|
||||
g_slist_free(zbee_gp_keyring);
|
||||
zbee_gp_keyring = NULL;
|
||||
}
|
||||
if (!zbee_gp_keyring)
|
||||
return;
|
||||
|
||||
g_slist_foreach(zbee_gp_keyring, zbee_free_key_record, NULL);
|
||||
|
||||
g_slist_free(zbee_gp_keyring);
|
||||
zbee_gp_keyring = NULL;
|
||||
}
|
||||
|
||||
/*FUNCTION:------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue