Add the sender name in signal subscribe function
[platform/core/connectivity/bluetooth-frwk.git] / bt-otp / bt-otpserver.c
index 95b6e39..76a8d9e 100644 (file)
@@ -693,7 +693,7 @@ static void _bt_otp_method(GDBusConnection *connection,
                struct stat st;
                struct object_metadata *object = NULL;
 
-               g_variant_get(parameters, "(s)", &directory);
+               g_variant_get(parameters, "(&s)", &directory);
                BT_DBG("Directory = [%s]", directory);
 
                dir = g_dir_open(directory, 0, &error);
@@ -789,7 +789,7 @@ fail:
                char address[BT_ADDRESS_STRING_SIZE] = { 0 };
                int fd;
 
-               g_variant_get(parameters, "(oh)", &dev_path, &index);
+               g_variant_get(parameters, "(&oh)", &dev_path, &index);
 
                msg = g_dbus_method_invocation_get_message(invocation);
                fd_list = g_dbus_message_get_unix_fd_list(msg);
@@ -1188,8 +1188,6 @@ void _bt_otp_create_new_object(uint32_t size, char *uuid)
        curr_obj_index = g_slist_length(otp_object_list) - 1;
        curr_obj_id = selected_object->id;
        object_id++;
-
-       free(uuid);
 }
 
 void _bt_otp_restore_old_object()
@@ -1224,7 +1222,7 @@ int _bt_otp_oacp_write_cb(char *value, int len, int offset,
        int opcode = value[0];
        uint32_t object_offset, length, object_size;
        uint8_t mode = 0;
-       char *uuid;
+       char *uuid = NULL;
        char absolute_file_path[BT_FILE_PATH_MAX_LEN] = {0, };
 
        BT_INFO("OACP Opcode 0x%d", opcode);
@@ -1258,6 +1256,7 @@ int _bt_otp_oacp_write_cb(char *value, int len, int offset,
 
                oacp_create = TRUE;
                _bt_otp_create_new_object(object_size, uuid);
+               g_free(uuid);
 
                if (oacp_create_timeout_id > 0)
                        g_source_remove(oacp_create_timeout_id);
@@ -2174,7 +2173,7 @@ int _bt_otp_init_event_receiver()
                                        NULL, NULL);
 
        device_property_sub_id = g_dbus_connection_signal_subscribe(conn,
-                               NULL, BT_PROPERTIES_INTERFACE,
+                               BT_BLUEZ_NAME, BT_PROPERTIES_INTERFACE,
                                PROPERTIES_CHANGED, NULL, NULL, 0,
                                _bt_otp_device_property_event_filter,
                                NULL, NULL);