diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-03-19 19:28:19 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-03-19 19:28:51 +0200 |
commit | 48f93f761916004df5b43dd6fbb25dc937599386 (patch) | |
tree | 4ae29cc65e9fabaff8b11cc306b58c00c0b20add /attrib | |
parent | b82916dadfcdb5cbe65aa14f140265dd5b01a65c (diff) | |
download | bluez-48f93f761916004df5b43dd6fbb25dc937599386.tar.gz |
attrib: Use destroy notify for included query
Diffstat (limited to 'attrib')
-rw-r--r-- | attrib/gatt.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/attrib/gatt.c b/attrib/gatt.c index 7e5803d41..1816234c2 100644 --- a/attrib/gatt.c +++ b/attrib/gatt.c @@ -342,16 +342,19 @@ static void resolve_included_uuid_cb(uint8_t status, const uint8_t *pdu, uuid = att_get_uuid128(buf); bt_uuid_to_string(&uuid, incl->uuid, sizeof(incl->uuid)); isd->includes = g_slist_append(isd->includes, incl); + query->included = NULL; done: - if (err) - g_free(incl); - if (isd->err == 0) isd->err = err; +} - isd_unref(isd); +static void inc_query_free(void *data) +{ + struct included_uuid_query *query = data; + isd_unref(query->isd); + g_free(query->included); g_free(query); } @@ -368,7 +371,8 @@ static guint resolve_included_uuid(struct included_discovery *isd, query->included = incl; return g_attrib_send(isd->attrib, 0, buf, oplen, - resolve_included_uuid_cb, query, NULL); + resolve_included_uuid_cb, query, + inc_query_free); } static struct gatt_included *included_from_buf(const uint8_t *buf, gsize len) |