Author: abroekhuis
Date: Wed Dec 10 09:26:56 2014
New Revision: 1644357

URL: http://svn.apache.org/r1644357
Log:
CELIX-190: Applied patch.

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=1644357&r1=1644356&r2=1644357&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 
Wed Dec 10 09:26:56 2014
@@ -160,6 +160,8 @@ celix_status_t topologyManager_rsaAdded(
                }
        }
 
+    hashMapIterator_destroy(importedServicesIterator);
+
        status = celixThreadMutex_unlock(&manager->importedServicesLock);
 
        // add already exported services to new rsa
@@ -183,6 +185,8 @@ celix_status_t topologyManager_rsaAdded(
                }
     }
 
+    hashMapIterator_destroy(exportedServicesIterator);
+
        status = celixThreadMutex_unlock(&manager->exportedServicesLock);
 
        return status;
@@ -227,6 +231,9 @@ celix_status_t topologyManager_rsaRemove
 
         hashMap_remove(exports, rsa);
     }
+
+    hashMapIterator_destroy(iter);
+
     status = celixThreadMutex_unlock(&manager->exportedServicesLock);
 
     fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "TOPOLOGY_MANAGER: Removed RSA");
@@ -387,6 +394,8 @@ celix_status_t topologyManager_addExport
                }
        }
 
+       arrayList_destroy(localRSAs);
+
        status = celixThreadMutex_unlock(&manager->exportedServicesLock);
 
        return status;
@@ -424,6 +433,10 @@ celix_status_t topologyManager_removeExp
                }
                hashMapIterator_destroy(iter);
        }
+    exports = hashMap_remove(manager->exportedServices, reference);
+    if (exports != NULL) {
+        hashMap_destroy(exports, false, false);
+    }
 
        status = celixThreadMutex_unlock(&manager->exportedServicesLock);
 
@@ -611,10 +624,18 @@ celix_status_t topologyManager_listenerR
                status = celixThreadMutex_lock(&manager->importInterestsLock);
 
                struct import_interest *interest = 
hashMap_get(manager->importInterests, filter);
-               if (interest != NULL && interest->refs-- <= 0) {
-                       // last reference, remove from scope
-                       interest = hashMap_remove(manager->importInterests, 
filter);
-               }
+        if (interest != NULL && --interest->refs <= 0) {
+            // last reference, remove from scope
+            hash_map_entry_pt entry = 
hashMap_getEntry(manager->importInterests, filter);
+            char* key = (char*) hashMapEntry_getKey(entry);
+            interest = hashMap_remove(manager->importInterests, filter);
+            free(key);
+            free(interest);
+        }
+
+        if (filter != NULL) {
+            free(filter);
+        }
 
                status = celixThreadMutex_unlock(&manager->importInterestsLock);
        }


Reply via email to