celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1647014 - in /celix/trunk/remote_services: remote_service_admin_http/private/src/import_registration_impl.c remote_service_admin_http/private/src/remote_service_admin_impl.c topology_manager/private/src/topology_manager.c
Date Sat, 20 Dec 2014 16:37:14 GMT
Author: bpetri
Date: Sat Dec 20 16:37:14 2014
New Revision: 1647014

URL: http://svn.apache.org/r1647014
Log:
CELIX-190: remote services mem leak fixing...

Modified:
    celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
    celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
    celix/trunk/remote_services/topology_manager/private/src/topology_manager.c

Modified: celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c?rev=1647014&r1=1647013&r2=1647014&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
(original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
Sat Dec 20 16:37:14 2014
@@ -110,6 +110,7 @@ celix_status_t importRegistrationFactory
 		free((*registration_factory)->serviceName);
 		arrayList_destroy((*registration_factory)->registrations);
 
+		serviceTracker_destroy((*registration_factory)->proxyFactoryTracker);
 		free(*registration_factory);
 	}
 
@@ -229,7 +230,8 @@ celix_status_t importRegistrationFactory
 		// check whether factory is available
 		if (((*registration_factory)->trackedFactory == NULL) && ((status = importRegistrationFactory_open(*registration_factory))
!= CELIX_SUCCESS)) {
 			logHelper_log((*registration_factory)->loghelper, OSGI_LOGSERVICE_ERROR, "remoteServiceAdmin_importService:
cannot open registration_factory for %s.", serviceName);
-			serviceTracker_close((*registration_factory)->proxyFactoryTracker);
+
+			importRegistrationFactory_close(*registration_factory);
 			importRegistrationFactory_destroy(registration_factory);
 		}
 	}

Modified: celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c?rev=1647014&r1=1647013&r2=1647014&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
(original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Sat Dec 20 16:37:14 2014
@@ -213,7 +213,11 @@ celix_status_t remoteServiceAdmin_stop(r
     iter = hashMapIterator_create(admin->importedServices);
     while (hashMapIterator_hasNext(iter))
     {
-    	import_registration_factory_pt importFactory = hashMapIterator_nextValue(iter);
+    	hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
+
+    	char* service = hashMapEntry_getKey(entry);
+    	import_registration_factory_pt importFactory = hashMapEntry_getValue(entry);
+
         int i;
         for (i = 0; i < arrayList_size(importFactory->registrations); i++)
         {
@@ -227,6 +231,10 @@ celix_status_t remoteServiceAdmin_stop(r
 
         serviceTracker_close(importFactory->proxyFactoryTracker);
         importRegistrationFactory_close(importFactory);
+
+		hashMap_remove(admin->importedServices, service);
+		importRegistrationFactory_destroy(&importFactory);
+
     }
     hashMapIterator_destroy(iter);
     celixThreadMutex_unlock(&admin->importedServicesLock);
@@ -632,6 +640,7 @@ celix_status_t remoteServiceAdmin_remove
 			importRegistrationFactory_close(registration_factory);
 
 			hashMap_remove(admin->importedServices, endpointDescription->service);
+
 			importRegistrationFactory_destroy(&registration_factory);
 		}
     }

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=1647014&r1=1647013&r2=1647014&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 Sat Dec 20
16:37:14 2014
@@ -169,6 +169,11 @@ celix_status_t topologyManager_rsaAdded(
 
 		if (status == CELIX_SUCCESS) {
 		    hash_map_pt imports = hashMapEntry_getValue(entry);
+
+			if (imports == NULL) {
+				imports = hashMap_create(NULL, NULL, NULL, NULL);
+			}
+
 			hashMap_put(imports, service, import);
 		}
 	}
@@ -226,6 +231,7 @@ celix_status_t topologyManager_rsaRemove
 
     remote_service_admin_service_pt rsa = (remote_service_admin_service_pt) service;
 
+
     status = celixThreadMutex_lock(&manager->exportedServicesLock);
 
     hash_map_iterator_pt iter = hashMapIterator_create(manager->exportedServices);
@@ -350,6 +356,8 @@ celix_status_t topologyManager_addImport
 		}
 	}
 
+	arrayList_destroy(localRSAs);
+
 	status = celixThreadMutex_unlock(&manager->importedServicesLock);
 
 	return status;
@@ -384,6 +392,13 @@ celix_status_t topologyManager_removeImp
                 }
             }
             hashMapIterator_destroy(importsIter);
+
+        	imports = hashMap_remove(manager->importedServices, ep);
+
+        	if (imports != NULL) {
+        		hashMap_destroy(imports, false, false);
+        	}
+
 	    }
 	}
 	hashMapIterator_destroy(iter);
@@ -462,9 +477,11 @@ celix_status_t topologyManager_removeExp
 		}
 		hashMapIterator_destroy(iter);
 	}
-    exports = hashMap_remove(manager->exportedServices, reference);
-    if (exports != NULL) {
-        hashMap_destroy(exports, false, false);
+
+	exports = hashMap_remove(manager->exportedServices, reference);
+
+	if (exports != NULL) {
+		hashMap_destroy(exports, false, false);
     }
 
 	status = celixThreadMutex_unlock(&manager->exportedServicesLock);



Mime
View raw message