1 From: Johan Hedberg <johan.hedberg@nokia.com>
2 Date: Mon, 8 Jun 2009 04:03:32 +0000 (+0700)
3 Subject: Set ctxt->session to NULL after calling sdp_close on it
4 X-Git-Url: http://git.kernel.org/?p=bluetooth%2Fbluez.git;a=commitdiff_plain;h=ce0e301583fce9e4a691fea1a12794c2fb40626c;hp=bbd50bd6e7c2c1e9b519ece0c9c4ff23cc97e363
6 Set ctxt->session to NULL after calling sdp_close on it
8 This makes sure that we don't do a double-close in case the user callback
9 calls e.g. bt_cancel_discovery.
12 diff --git a/common/glib-helper.c b/common/glib-helper.c
13 index c06b32c..727c55d 100644
14 --- a/common/glib-helper.c
15 +++ b/common/glib-helper.c
16 @@ -234,6 +234,7 @@ static gboolean search_process_cb(GIOChannel *chan,
19 sdp_close(ctxt->session);
20 + ctxt->session = NULL;
23 ctxt->cb(NULL, err, ctxt->user_data);
24 @@ -290,6 +291,7 @@ static gboolean connect_watch(GIOChannel *chan, GIOCondition cond, gpointer user
27 sdp_close(ctxt->session);
28 + ctxt->session = NULL;
31 ctxt->cb(NULL, -err, ctxt->user_data);
32 @@ -395,7 +397,8 @@ int bt_cancel_discovery(const bdaddr_t *src, const bdaddr_t *dst)
34 g_source_remove(ctxt->io_id);
36 - sdp_close(ctxt->session);
38 + sdp_close(ctxt->session);
40 search_context_cleanup(ctxt);