This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch support/2.4
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 09eee1b9fae5b1998fb4753213259ca60acfce77
Author: PengZheng <[email protected]>
AuthorDate: Thu Nov 23 18:01:50 2023 +0800

    [CID 330808]Fix memory leak in RSA.
    
    (cherry picked from commit 20391a15c4b1e20349ca4a4471d3c78f7274c072)
---
 .../remote_services/discovery_common/src/discovery_activator.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/bundles/remote_services/discovery_common/src/discovery_activator.c 
b/bundles/remote_services/discovery_common/src/discovery_activator.c
index 3ebfe0ea..920cf008 100644
--- a/bundles/remote_services/discovery_common/src/discovery_activator.c
+++ b/bundles/remote_services/discovery_common/src/discovery_activator.c
@@ -106,7 +106,7 @@ celix_status_t bundleActivator_start(void * userData, 
celix_bundle_context_t *co
     int rc = asprintf(&scope, "(&(%s=*)(%s=%s))", OSGI_FRAMEWORK_OBJECTCLASS, 
OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
     status = rc < 0 ? CELIX_ENOMEM : CELIX_SUCCESS;
 
-    celix_properties_t *props = NULL;
+    celix_autoptr(celix_properties_t) props = NULL;
     if (status == CELIX_SUCCESS) {
         celix_logHelper_debug(activator->loghelper, "using scope %s.", scope);
 
@@ -131,16 +131,14 @@ celix_status_t bundleActivator_start(void * userData, 
celix_bundle_context_t *co
                        endpointListener->endpointAdded = 
discovery_endpointAdded;
                        endpointListener->endpointRemoved = 
discovery_endpointRemoved;
 
-                       status = bundleContext_registerService(context, (char 
*) OSGI_ENDPOINT_LISTENER_SERVICE, endpointListener, props, 
&activator->endpointListenerService);
+                       status = bundleContext_registerService(context, (char 
*) OSGI_ENDPOINT_LISTENER_SERVICE, endpointListener,
+                                                   celix_steal_ptr(props), 
&activator->endpointListenerService);
 
                        if (status == CELIX_SUCCESS) {
                                activator->endpointListener = endpointListener;
                        }
                }
-       } else {
-        celix_properties_destroy(props);
-    }
-
+       }
        // We can release the scope, as celix_properties_set makes a copy of 
the key & value...
        free(scope);
 

Reply via email to