celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpe...@apache.org
Subject svn commit: r1640538 - /celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c
Date Wed, 19 Nov 2014 13:05:39 GMT
Author: bpetri
Date: Wed Nov 19 13:05:39 2014
New Revision: 1640538

URL: http://svn.apache.org/r1640538
Log:
CELIX-185: Applied patch

Modified:
    celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c

Modified: celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c?rev=1640538&r1=1640537&r2=1640538&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c (original)
+++ celix/trunk/remote_services/discovery/private/src/endpoint_descriptor_reader.c Wed Nov
19 13:05:39 2014
@@ -66,7 +66,7 @@ celix_status_t endpointDescriptorReader_
 }
 
 void endpointDescriptorReader_addSingleValuedProperty(properties_pt properties, const xmlChar*
name, const xmlChar* value) {
-	properties_set(properties, strdup((char *) name), strdup((char *) value));
+	properties_set(properties, (char *) name, (char*) value);
 }
 
 void endpointDescriptorReader_addMultiValuedProperty(properties_pt properties, const xmlChar*
name, array_list_pt values) {
@@ -81,7 +81,7 @@ void endpointDescriptorReader_addMultiVa
 			value = strcat(value, item);
 		}
 
-		properties_set(properties, strdup((char *) name), strdup(value));
+		properties_set(properties, (char *) name, value);
 
 		free(value);
 	}
@@ -166,6 +166,7 @@ celix_status_t endpointDescriptorReader_
                         	if (propertyType != VALUE_TYPE_STRING && strcmp(OSGI_RSA_ENDPOINT_SERVICE_ID,
(char*) propertyName)) {
                         		fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "ENDPOINT_DESCRIPTOR_READER:
Only single-valued string supported for %s\n", propertyName);
                         	}
+
                         	endpointDescriptorReader_addSingleValuedProperty(endpointProperties,
propertyName, propertyValue);
                         }
 
@@ -219,6 +220,10 @@ celix_status_t endpointDescriptorReader_
                     }
 
                     xmlFree((void *) propertyName);
+					int k=0;
+					for(;k<arrayList_size(propertyValues);k++){
+						free(arrayList_get(propertyValues,k));
+					}
                     arrayList_clear(propertyValues);
 
                     propertyType = VALUE_TYPE_STRING;
@@ -242,6 +247,14 @@ celix_status_t endpointDescriptorReader_
             read = xmlTextReaderRead(reader->reader);
         }
 
+		if(endpointProperties!=NULL){
+			properties_destroy(endpointProperties);
+		}
+
+		int k=0;
+		for(;k<arrayList_size(propertyValues);k++){
+			free(arrayList_get(propertyValues,k));
+		}
         arrayList_destroy(propertyValues);
         xmlFree(valueBuffer);
 



Mime
View raw message