OSDN Git Service

core: Fix find included handling with sudden disconnections
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 5 Jun 2013 10:42:32 +0000 (13:42 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 7 Jun 2013 15:00:28 +0000 (18:00 +0300)
src/device.c

index 55842b6..d4c1e23 100644 (file)
@@ -3177,6 +3177,13 @@ static void find_included_cb(GSList *includes, uint8_t status,
        struct gatt_primary *prim;
        GSList *l;
 
+       if (device->attrib == NULL) {
+               error("Disconnected while doing included discovery");
+               g_slist_free(search->services);
+               g_free(search);
+               return;
+       }
+
        if (status != 0) {
                error("Find included services failed: %s (%d)",
                                        att_ecode2str(status), status);