celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1644502 - in /celix/trunk/remote_services: discovery/private/src/endpoint_discovery_poller.c topology_manager/private/src/activator.c
Date Wed, 10 Dec 2014 18:36:56 GMT
Author: bpetri
Date: Wed Dec 10 18:36:55 2014
New Revision: 1644502

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

Modified:
    celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c
    celix/trunk/remote_services/topology_manager/private/src/activator.c

Modified: celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c?rev=1644502&r1=1644501&r2=1644502&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_discovery_poller.c Wed Dec
10 18:36:55 2014
@@ -190,17 +190,16 @@ celix_status_t endpointDiscoveryPoller_r
         return CELIX_BUNDLE_EXCEPTION;
     }
 
-    hash_map_entry_pt endpointEntry = hashMap_remove(poller->entries, url);
-
-    free(hashMapEntry_getKey(endpointEntry));
-    array_list_pt entries = hashMapEntry_getValue(endpointEntry);
+    array_list_pt entries = hashMap_remove(poller->entries, url);
 
 	for (int i = 0; i < arrayList_size(entries); i++) {
 		endpoint_description_pt endpoint = arrayList_get(entries, i);
-
 		discovery_removeDiscoveredEndpoint(poller->discovery, endpoint);
 	}
-	arrayList_destroy(entries);
+
+	if (entries != NULL) {
+		arrayList_destroy(entries);
+	}
 
 	status = celixThreadMutex_unlock(&poller->pollerLock);
 

Modified: celix/trunk/remote_services/topology_manager/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/topology_manager/private/src/activator.c?rev=1644502&r1=1644501&r2=1644502&view=diff
==============================================================================
--- celix/trunk/remote_services/topology_manager/private/src/activator.c (original)
+++ celix/trunk/remote_services/topology_manager/private/src/activator.c Wed Dec 10 18:36:55
2014
@@ -57,6 +57,7 @@ celix_status_t bundleActivator_create(bu
 	struct activator *activator = NULL;
 
 	activator = malloc(sizeof(struct activator));
+
 	if (!activator) {
 		return CELIX_ENOMEM;
 	}
@@ -173,6 +174,7 @@ celix_status_t bundleActivator_stop(void
 	struct activator *activator = userData;
 
 	serviceTracker_close(activator->remoteServiceAdminTracker);
+	serviceTracker_destroy(activator->remoteServiceAdminTracker);
 
 	bundleContext_removeServiceListener(context, activator->serviceListener);
 
@@ -183,10 +185,16 @@ celix_status_t bundleActivator_stop(void
 }
 
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
+	celix_status_t status = CELIX_SUCCESS;
+
 	struct activator *activator = userData;
 	if (!activator || !activator->manager) {
-		return CELIX_BUNDLE_EXCEPTION;
+		status = CELIX_BUNDLE_EXCEPTION;
+	}
+	else {
+		status = topologyManager_destroy(activator->manager);
+		free(activator);
 	}
 
-	return topologyManager_destroy(activator->manager);
+	return status;
 }



Mime
View raw message