From 67696e910549b77004bf7f68003a46728c891f05 Mon Sep 17 00:00:00 2001 From: Alok Barsode Date: Thu, 28 Aug 2008 14:47:04 +0530 Subject: Freeing found_devices list on end of standard/periodic inquiry. --- src/adapter.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/adapter.c') 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; } -- cgit