celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1651961 - in /celix/trunk/remote_services: remote_service_admin/private/src/export_registration_impl.c topology_manager/private/src/topology_manager.c
Date Thu, 15 Jan 2015 07:55:46 GMT
Author: bpetri
Date: Thu Jan 15 07:55:46 2015
New Revision: 1651961

URL: http://svn.apache.org/r1651961
Log:

CELIX-190: fixed memory leak in exportRegistration


Modified:
    celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
    celix/trunk/remote_services/topology_manager/private/src/topology_manager.c

Modified: celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c?rev=1651961&r1=1651960&r2=1651961&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
(original)
+++ celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
Thu Jan 15 07:55:46 2015
@@ -221,16 +221,15 @@ celix_status_t exportRegistration_getExc
 celix_status_t exportRegistration_getExportReference(export_registration_pt registration,
export_reference_pt *reference) {
 	celix_status_t status = CELIX_SUCCESS;
 
+	registration->exportReference = calloc(1, sizeof(*registration->exportReference));
+
 	if (registration->exportReference == NULL) {
-		registration->exportReference = calloc(1, sizeof(*registration->exportReference));
-		if (registration->exportReference == NULL) {
-			status = CELIX_ENOMEM;
-		} else {
-			registration->exportReference->endpoint = registration->endpointDescription;
-			registration->exportReference->reference = registration->reference;
-		}
+		status = CELIX_ENOMEM;
+	} else {
+		registration->exportReference->endpoint = registration->endpointDescription;
+		registration->exportReference->reference = registration->reference;
 	}
-
+	
 	*reference = registration->exportReference;
 
 	return status;

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=1651961&r1=1651960&r2=1651961&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 Thu Jan 15
07:55:46 2015
@@ -528,11 +528,12 @@ celix_status_t topologyManager_getEndpoi
 
 	export_reference_pt reference = NULL;
 	status = rsa->exportRegistration_getExportReference(export, &reference);
-	if (status != CELIX_SUCCESS) {
-		return status;
+
+	if (status == CELIX_SUCCESS) {
+	    status = rsa->exportReference_getExportedEndpoint(reference, endpoint);
 	}
 
-	status = rsa->exportReference_getExportedEndpoint(reference, endpoint);
+	free(reference);
 
 	return status;
 }



Mime
View raw message