From 341b69ce7c11c12b94b9dd781ed3d32188021ddb Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 30 Apr 2015 17:00:38 -0500 Subject: [PATCH] wiphy: Fix memory leak This happens when connecting / disconnecting successfully multiple times. ==4336== 64 bytes in 2 blocks are definitely lost in loss record 9 of 11 ==4336== at 0x4C2B970: malloc (vg_replace_malloc.c:296) ==4336== by 0x40CEED: l_malloc (util.c:62) ==4336== by 0x40D6D9: l_util_from_hexstring (util.c:493) ==4336== by 0x4049C6: network_connect_psk (wiphy.c:315) ==4336== by 0x4049C6: network_connect (wiphy.c:359) ==4336== by 0x41D7EE: _dbus_object_tree_dispatch (dbus-service.c:845) ==4336== by 0x416A16: message_read_handler (dbus.c:297) ==4336== by 0x411984: io_callback (io.c:120) ==4336== by 0x410FC2: l_main_run (main.c:346) ==4336== by 0x40253E: main (main.c:171) --- src/wiphy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wiphy.c b/src/wiphy.c index 1749eb38..d01578fd 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -312,6 +312,8 @@ static struct l_dbus_message *network_connect_psk(struct network *network, size_t len; l_debug("psk: %s", psk); + + l_free(network->psk); network->psk = l_util_from_hexstring(psk, &len); l_debug("len: %zd", len);