celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1660329 - in /celix/trunk/framework/private/src: module.c resolver.c
Date Tue, 17 Feb 2015 09:29:56 GMT
Author: abroekhuis
Date: Tue Feb 17 09:29:55 2015
New Revision: 1660329

URL: http://svn.apache.org/r1660329
Log:
CELIX-219: Fixed memory leaks in the resolver.

The resolver now properly cleans up the capabilities list.
Modules now destroy the wires when needed (either on a destroy, or when set to NULL by the
bundle).

Modified:
    celix/trunk/framework/private/src/module.c
    celix/trunk/framework/private/src/resolver.c

Modified: celix/trunk/framework/private/src/module.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/module.c?rev=1660329&r1=1660328&r2=1660329&view=diff
==============================================================================
--- celix/trunk/framework/private/src/module.c (original)
+++ celix/trunk/framework/private/src/module.c Tue Feb 17 09:29:55 2015
@@ -207,8 +207,15 @@ void module_setWires(module_pt module, l
     }
 
     if (module->wires != NULL) {
-    	linkedList_destroy(module->wires);
-    }
+		linked_list_iterator_pt iter = linkedListIterator_create(module->wires, 0);
+		while (linkedListIterator_hasNext(iter)) {
+			wire_pt next = linkedListIterator_next(iter);
+			linkedListIterator_remove(iter);
+			wire_destroy(next);
+		}
+		linkedListIterator_destroy(iter);
+		linkedList_destroy(module->wires);
+	}
 
 	module->wires = wires;
 

Modified: celix/trunk/framework/private/src/resolver.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/resolver.c?rev=1660329&r1=1660328&r2=1660329&view=diff
==============================================================================
--- celix/trunk/framework/private/src/resolver.c (original)
+++ celix/trunk/framework/private/src/resolver.c Tue Feb 17 09:29:55 2015
@@ -289,10 +289,16 @@ void resolver_removeModule(module_pt mod
             list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
             if (list != NULL) {
                 linkedList_removeElement(list->capabilities, cap);
+                linkedList_destroy(list->capabilities);
+                free(list->serviceName);
+                free(list);
             }
             list = resolver_getCapabilityList(m_resolvedServices, serviceName);
             if (list != NULL) {
                 linkedList_removeElement(list->capabilities, cap);
+                linkedList_destroy(list->capabilities);
+                free(list->serviceName);
+				free(list);
             }
         }
     }



Mime
View raw message