OSDN Git Service

core: Remove unnecessary btd_device reference count in browse_req
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 15 Jul 2013 11:29:54 +0000 (14:29 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 15 Jul 2013 11:34:05 +0000 (14:34 +0300)
The browse request is "owned" by the btd_device structure so it doesn't
make sense to have browse_req keeping an extra reference for the
btd_device.

src/device.c

index f001502..a46ee06 100644 (file)
@@ -435,8 +435,6 @@ static void browse_request_free(struct browse_req *req)
                g_dbus_remove_watch(dbus_conn, req->listener_id);
        if (req->msg)
                dbus_message_unref(req->msg);
-       if (req->device)
-               btd_device_unref(req->device);
        g_slist_free_full(req->profiles_added, g_free);
        if (req->records)
                sdp_list_free(req->records, (sdp_free_func_t) sdp_record_free);
@@ -3426,7 +3424,7 @@ static int device_browse_primary(struct btd_device *device, DBusMessage *msg)
                return -EBUSY;
 
        req = g_new0(struct browse_req, 1);
-       req->device = btd_device_ref(device);
+       req->device = device;
 
        device->browse = req;
 
@@ -3485,7 +3483,7 @@ static int device_browse_sdp(struct btd_device *device, DBusMessage *msg)
                return -EBUSY;
 
        req = g_new0(struct browse_req, 1);
-       req->device = btd_device_ref(device);
+       req->device = device;
        sdp_uuid16_create(&uuid, uuid_list[req->search_uuid++]);
 
        err = bt_search_service(adapter_get_address(adapter), &device->bdaddr,