Fix the svace issue - MEMORY LEAK 20/235320/1 accepted/tizen/unified/20200605.020512 submit/tizen/20200604.003952
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 3 Jun 2020 23:53:15 +0000 (08:53 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 3 Jun 2020 23:53:15 +0000 (08:53 +0900)
Change-Id: Id407c2e5d9c6925f24198da9359ec3fdd54be8bc
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-api/bt-common.c

index 867e43f..39b5480 100644 (file)
@@ -1779,8 +1779,10 @@ int _bt_disconnect_ext_profile(char *address, char *path)
                return BLUETOOTH_ERROR_INTERNAL;
 
        gconn = _bt_get_system_shared_conn();
-       if (gconn == NULL)
+       if (gconn == NULL) {
+               g_free(object_path);
                return BLUETOOTH_ERROR_INTERNAL;
+       }
 
        proxy = g_dbus_proxy_new_sync(gconn, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
                                                NULL, BT_BLUEZ_NAME,
@@ -1788,12 +1790,13 @@ int _bt_disconnect_ext_profile(char *address, char *path)
                                                BT_DEVICE_INTERFACE,
                                                NULL, &err);
 
+       g_free(object_path);
+
        if (proxy == NULL && err) {
                BT_ERR("Unable to create proxy: %s", err->message);
                g_clear_error(&err);
                return BLUETOOTH_ERROR_INTERNAL;
        }
-       g_free(object_path);
 
        g_dbus_proxy_call(proxy, "DisconnectExtProfile",
                        g_variant_new("(o)", path),