Ver código fonte

print_object was calling free() rather than cJSON_free() under failure conditions!

git-svn-id: http://svn.code.sf.net/p/cjson/code@36 e3330c51-1366-4df0-8b21-3ccf24e3d50e
Dave Gamble 14 anos atrás
pai
commit
b5d2db4d9a
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      cJSON.c

+ 2 - 2
cJSON.c

@@ -428,8 +428,8 @@ static char *print_object(cJSON *item,int depth,int fmt)
 	/* Handle failure */
 	if (fail)
 	{
-		for (i=0;i<numentries;i++) {if (names[i]) free(names[i]);if (entries[i]) free(entries[i]);}
-		free(names);free(entries);
+		for (i=0;i<numentries;i++) {if (names[i]) cJSON_free(names[i]);if (entries[i]) cJSON_free(entries[i]);}
+		cJSON_free(names);cJSON_free(entries);
 		return 0;
 	}