OSDN Git Service

Fix memory leak in RFCOMM sockets where some lists were not being freed.
authorSharvil Nanavati <sharvil@google.com>
Sat, 30 Aug 2014 01:26:23 +0000 (18:26 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 16 Mar 2015 23:51:32 +0000 (16:51 -0700)
btif/src/btif_sock_rfc.c

index 7ff36cb..1c0cbfb 100644 (file)
@@ -117,12 +117,11 @@ void btsock_rfc_cleanup(void) {
   pth = -1;
 
   lock_slot(&slot_lock);
-  for (size_t i = 0; i < ARRAY_SIZE(rfc_slots); ++i)
-    if (rfc_slots[i].id) {
+  for (size_t i = 0; i < ARRAY_SIZE(rfc_slots); ++i) {
+    if (rfc_slots[i].id)
       cleanup_rfc_slot(&rfc_slots[i]);
-      list_free(rfc_slots[i].incoming_queue);
-      rfc_slots[i].incoming_queue = NULL;
-    }
+    list_free(rfc_slots[i].incoming_queue);
+  }
   unlock_slot(&slot_lock);
 }