Add the sender name in signal subscribe function
[platform/core/connectivity/bluetooth-frwk.git] / bt-service-adaptation / services / obex / bt-service-map-client.c
index 08f0295..326b2e8 100644 (file)
@@ -138,6 +138,7 @@ int _bt_destroy_session_sync(const char* session_id)
        GDBusConnection *g_conn;
        GDBusProxy *session_proxy;
        GError *err = NULL;
+       GVariant *result;
 
        retv_if(session_id == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
 
@@ -158,13 +159,16 @@ int _bt_destroy_session_sync(const char* session_id)
 
        GVariant *param = g_variant_new("(o)", session_id);
 
-       g_dbus_proxy_call_sync(session_proxy, "RemoveSession", param,
+       result = g_dbus_proxy_call_sync(session_proxy, "RemoveSession", param,
                        G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
-       if (err != NULL) {
-               BT_ERR("Could not remove session: %s\n", err->message);
-               g_error_free(err);
-               return BLUETOOTH_ERROR_INTERNAL;
+       if (!result) {
+               if (err) {
+                       BT_ERR("Could not remove session: %s\n", err->message);
+                       g_error_free(err);
+                       return BLUETOOTH_ERROR_INTERNAL;
+               }
        } else {
+               g_variant_unref(result);
                BT_DBG("remove session succeed\n");
        }
 
@@ -658,7 +662,8 @@ int _bt_map_client_push_message(
                }
        }
 
-       g_object_unref(message_access_proxy);
+       if (message_access_proxy)
+               g_object_unref(message_access_proxy);
        BT_DBG("-");
 
        return result;
@@ -756,7 +761,8 @@ int _bt_map_client_get_message(
                }
        }
 
-       g_object_unref(message_proxy);
+       if (message_proxy)
+               g_object_unref(message_proxy);
        BT_DBG("-");
 
        return result;