Fixed memory leaks 04/188804/1 accepted/tizen/unified/20180911.055420 submit/tizen/20180910.131901
authorSaurav Babu <saurav.babu@samsung.com>
Mon, 10 Sep 2018 10:46:34 +0000 (16:16 +0530)
committerSaurav Babu <saurav.babu@samsung.com>
Mon, 10 Sep 2018 10:46:34 +0000 (16:16 +0530)
commite469284b11781b41436ad0ab753e7378581ce75b
treec872964feab151fb2eb40fa2bcf72f5c9a0e7658
parent9ba7ae6aab424bf1df7b5de377cd858722c51d42
Fixed memory leaks

g_variant_builder_new() allocates memory and should be freed using
g_variant_builder_unref().
Below is the valgrind report:
==6712== 72 bytes in 1 blocks are definitely lost in loss record 2,933 of 3,062
==6712==    at 0x48458A4: malloc (vg_replace_malloc.c:299)
==6712==    by 0x4AB21B3: g_malloc (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4ACB4A3: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4AE82BF: g_variant_builder_new (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x1236F1: __netconfig_update_default_connection_info (network-state.c:797)
==6712==    by 0x125727: netconfig_update_default_profile (network-state.c:1206)
==6712==    by 0x12AA1D: _service_signal_cb (signal-handler.c:355)
==6712==    by 0x4957997: ??? (in /usr/lib/libgio-2.0.so.0.5200.2)
==6712==    by 0x4AAC8E7: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4AACC77: ??? (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4AACFD7: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x10F9F9: main (main.c:152)
==6712==
==6712== 72 bytes in 1 blocks are definitely lost in loss record 2,934 of 3,062
==6712==    at 0x48458A4: malloc (vg_replace_malloc.c:299)
==6712==    by 0x4AB21B3: g_malloc (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4ACB4A3: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4AE82BF: g_variant_builder_new (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x123A8D: __netconfig_update_default_connection_info (network-state.c:764)
==6712==    by 0x125923: netconfig_update_default_profile (network-state.c:1193)
==6712==    by 0x12B71F: _service_signal_cb (signal-handler.c:399)
==6712==    by 0x4957997: ??? (in /usr/lib/libgio-2.0.so.0.5200.2)
==6712==    by 0x4AAC8E7: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4AACC77: ??? (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x4AACFD7: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.5200.2)
==6712==    by 0x10F9F9: main (main.c:152)

Change-Id: I2306aaa418fb04d29f7f717a25c0abe4bf47dc30
Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
src/network-state.c
src/signal-handler.c
src/wifi-bssid-scan.c