celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1644843 - /celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
Date Fri, 12 Dec 2014 07:16:18 GMT
Author: bpetri
Date: Fri Dec 12 07:16:18 2014
New Revision: 1644843

URL: http://svn.apache.org/r1644843
Log:
CELIX-190: fixed minor leak

Modified:
    celix/trunk/remote_services/topology_manager/private/src/topology_manager.c

Modified: celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c?rev=1644843&r1=1644842&r2=1644843&view=diff
==============================================================================
--- celix/trunk/remote_services/topology_manager/private/src/topology_manager.c (original)
+++ celix/trunk/remote_services/topology_manager/private/src/topology_manager.c Fri Dec 12
07:16:18 2014
@@ -113,21 +113,7 @@ celix_status_t topologyManager_destroy(t
 
 	status = celixThreadMutex_lock(&manager->importInterestsLock);
 
-	hash_map_iterator_pt iterator = hashMapIterator_create(manager->importInterests);
-
-	while (hashMapIterator_hasNext(iterator)) {
-		hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
-		char* key = (char*) hashMapEntry_getKey(entry);
-		struct import_interest *interest = hashMap_remove(manager->importInterests, key);
-
-		free(key);
-		free(interest);
-
-		hashMapIterator_destroy(iterator);
-		iterator = hashMapIterator_create(manager->importInterests);
-	}
-	hashMapIterator_destroy(iterator);
-	hashMap_destroy(manager->importInterests, false, false);
+	hashMap_destroy(manager->importInterests, true, true);
 
 	status = celixThreadMutex_unlock(&manager->importInterestsLock);
 	status = celixThreadMutex_destroy(&manager->importInterestsLock);
@@ -602,6 +588,7 @@ celix_status_t topologyManager_listenerA
 		struct import_interest *interest = hashMap_get(manager->importInterests, filter);
 		if (interest) {
 			interest->refs++;
+			free(filter);
 		} else {
 			interest = malloc(sizeof(*interest));
 			interest->filter = filter;



Mime
View raw message