Fix memory leaks which are caught by gtest and valgrind 25/238525/1
authorYu <jiung.yu@samsung.com>
Wed, 15 Jul 2020 00:46:47 +0000 (09:46 +0900)
committerYu <jiung.yu@samsung.com>
Wed, 15 Jul 2020 00:46:59 +0000 (09:46 +0900)
Change-Id: Ifc87fb0f8398bd329fab96a233e0d05b6ee2ff0a
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
packaging/capi-network-wifi-direct.spec
src/wifi-direct-client-proxy.c

index d8ada75..4f00068 100755 (executable)
@@ -3,7 +3,7 @@
 
 Name:       capi-network-wifi-direct
 Summary:    Network WiFi-Direct Library
-Version:    1.3.0
+Version:    1.3.1
 Release:    1
 Group:      Network & Connectivity/API
 License:    Apache-2.0
index 08c699b..475c0a4 100755 (executable)
@@ -412,14 +412,15 @@ void wifi_direct_process_manage_peer_ip_assigned(GDBusConnection *connection,
        }
 
        g_variant_get(reply, "(i&s)", &ret, &get_str);
-       g_variant_unref(reply);
 
-       WDC_LOGD("Interface Name = [%s]", get_str);
+       if (get_str)
+               WDC_LOGD("Interface Name = [%s]", get_str);
        WDC_LOGD("%s() return : [%d]", __func__, ret);
 
        client->ip_assigned_cb(peer_mac_address, assigned_ip_address, get_str,
                        client->user_data_for_cb_ip_assigned);
 
+       g_variant_unref(reply);
        __WDC_LOG_FUNC_END__;
 }
 
@@ -880,6 +881,7 @@ EXPORT_API int wifi_direct_initialize(void)
        }
 
        g_variant_get(reply, "(i)", &res);
+       g_variant_unref(reply);
        WDC_LOGD("Active Client id Added, ret[%d]", res);
 
        g_client_info.is_registered = TRUE;
@@ -3371,6 +3373,7 @@ EXPORT_API int wifi_direct_foreach_persistent_groups(wifi_direct_persistent_grou
        }
 
        g_variant_iter_free(iter_groups);
+       g_variant_unref(reply);
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
 }
@@ -3682,6 +3685,7 @@ EXPORT_API int wifi_direct_get_peer_info(char* mac_address, wifi_direct_discover
 
        *peer_info = peer;
 
+       g_variant_iter_free(iter_peer);
        g_variant_unref(reply);
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
@@ -4512,6 +4516,7 @@ EXPORT_API int wifi_direct_get_connecting_peer_info(
 
        *peer_info = peer;
 
+       g_variant_iter_free(iter_peer);
        g_variant_unref(reply);
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);