celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1650075 - /celix/trunk/framework/private/src/filter.c
Date Wed, 07 Jan 2015 14:52:49 GMT
Author: abroekhuis
Date: Wed Jan  7 14:52:49 2015
New Revision: 1650075

URL: http://svn.apache.org/r1650075
Log:
CELIX-197: Fixed allocation problems in filter.c.

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

Modified: celix/trunk/framework/private/src/filter.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/filter.c?rev=1650075&r1=1650074&r2=1650075&view=diff
==============================================================================
--- celix/trunk/framework/private/src/filter.c (original)
+++ celix/trunk/framework/private/src/filter.c Wed Jan  7 14:52:49 2015
@@ -317,7 +317,7 @@ char * filter_parseAttr(char * filterStr
 }
 
 char * filter_parseValue(char * filterString, int * pos) {
-	char * value = strdup("");
+	char *value = calloc(strlen(filterString) + 1, sizeof(*value));
 	int keepRunning = 1;
 
 	while (keepRunning) {
@@ -356,13 +356,12 @@ char * filter_parseValue(char * filterSt
 }
 
 array_list_pt filter_parseSubstring(char * filterString, int * pos) {
-	char * sub = (char *) malloc(strlen(filterString));
+	char *sub = calloc(strlen(filterString) + 1, sizeof(*sub));
 	array_list_pt operands = NULL;
 	int keepRunning = 1;
 	int size;
 
 	arrayList_create(&operands);
-	sub[0] = '\0';
 	while (keepRunning) {
 		char c = filterString[*pos];
 		



Mime
View raw message