celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1620877 - /celix/trunk/framework/private/src/service_registry.c
Date Wed, 27 Aug 2014 12:40:20 GMT
Author: abroekhuis
Date: Wed Aug 27 12:40:20 2014
New Revision: 1620877

URL: http://svn.apache.org/r1620877
Log:
Fixed incorrect(missing) pointer dereference

Modified:
    celix/trunk/framework/private/src/service_registry.c

Modified: celix/trunk/framework/private/src/service_registry.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/service_registry.c?rev=1620877&r1=1620876&r2=1620877&view=diff
==============================================================================
--- celix/trunk/framework/private/src/service_registry.c (original)
+++ celix/trunk/framework/private/src/service_registry.c Wed Aug 27 12:40:20 2014
@@ -312,7 +312,7 @@ celix_status_t serviceRegistry_createSer
 	if (references == NULL) {
 	    arrayList_create(&references);
 	}
-	arrayList_add(references, reference);
+	arrayList_add(references, *reference);
 	hashMap_put(registry->serviceReferences, bundle, references);
 
 	// Unlock
@@ -340,9 +340,13 @@ celix_status_t serviceRegistry_getServic
         for (refIdx = 0; (refs != NULL) && refIdx < arrayList_size(refs); refIdx++)
{
             service_registration_pt reg = NULL;
             service_reference_pt reference = (service_reference_pt) arrayList_get(refs, refIdx);
-            serviceReference_getServiceRegistration(reference, &reg);
-            if (reg == registration) {
-                arrayList_add(*references, reference);
+            bool valid = false;
+            serviceRefernce_isValid(reference, &valid);
+            if (valid) {
+                serviceReference_getServiceRegistration(reference, &reg);
+                if (reg == registration) {
+                    arrayList_add(*references, reference);
+                }
             }
         }
     }
@@ -422,6 +426,7 @@ celix_status_t serviceRegistry_ungetServ
     array_list_pt references = hashMap_get(registry->serviceReferences, owner);
     if (references != NULL) {
         arrayList_removeElement(references, reference);
+        serviceReference_destroy(reference);
         if (arrayList_size(references) > 0) {
             hashMap_put(registry->serviceReferences, owner, references);
         } else {



Mime
View raw message