summaryrefslogtreecommitdiffstats
path: root/src/adapter.c
diff options
context:
space:
mode:
authorAlok Barsode <alok.barsode@azingo.com>2008-08-28 14:47:04 +0530
committerAlok Barsode <alok.barsode@azingo.com>2008-08-29 13:53:11 +0530
commit67696e910549b77004bf7f68003a46728c891f05 (patch)
treeec5c1530e3745d4fe6dceb1340cd66f69fe388d4 /src/adapter.c
parent344789216712689037f57cb7bc2dc7a333a95333 (diff)
Freeing found_devices list on end of standard/periodic inquiry.
Diffstat (limited to 'src/adapter.c')
-rw-r--r--src/adapter.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/adapter.c b/src/adapter.c
index bc49090c..43f0521f 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2739,6 +2739,21 @@ void adapter_set_state(struct adapter *adapter, int state)
if (!adapter)
return;
+ /* Both Standard and periodic Inquiry are in progress */
+ if ((state & STD_INQUIRY) && (state & PERIODIC_INQUIRY))
+ goto set;
+
+ if (!adapter->found_devices)
+ goto set;
+
+ /* Free list if standard/periodic inquiry is done */
+ if ((adapter->state & (STD_INQUIRY | PERIODIC_INQUIRY)) &&
+ (state & (~STD_INQUIRY | ~PERIODIC_INQUIRY))) {
+ g_slist_foreach(adapter->found_devices, (GFunc) g_free, NULL);
+ g_slist_free(adapter->found_devices);
+ adapter->found_devices = NULL;
+ }
+set:
adapter->state = state;
}