3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 18:59:22 +01:00

network: Fix memory leak in network_set_psk

==1057== 32 bytes in 1 blocks are definitely lost in loss record 1 of 1
==1057==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
==1057==    by 0x15E9A2: l_malloc (util.c:62)
==1057==    by 0x15EA9D: l_memdup (util.c:121)
==1057==    by 0x133D9A: network_set_psk (network.c:350)
==1057==    by 0x13BD29: wsc_try_credentials (wsc.c:136)
==1057==    by 0x13C121: wsc_connect_cb (wsc.c:220)
==1057==    by 0x110FAF: netdev_connect_failed (netdev.c:525)
==1057==    by 0x16AAF4: process_unicast (genl.c:390)
==1057==    by 0x16AF03: received_data (genl.c:509)
==1057==    by 0x166CB6: io_callback (io.c:123)
==1057==    by 0x16580D: l_main_iterate (main.c:376)
==1057==    by 0x16594B: l_main_run (main.c:423)
This commit is contained in:
Denis Kenzior 2018-06-21 20:08:59 -05:00
parent 7c0bc22b7c
commit c5893f7da8

View File

@ -346,6 +346,9 @@ bool network_set_psk(struct network *network, const uint8_t *psk)
if (network->info->type != SECURITY_PSK) if (network->info->type != SECURITY_PSK)
return false; return false;
if (!network_settings_load(network))
return false;
l_free(network->psk); l_free(network->psk);
network->psk = l_memdup(psk, 32); network->psk = l_memdup(psk, 32);
return true; return true;