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
This commit is contained in:
Dave Gamble 2011-03-02 19:15:06 +00:00
parent 6f51f007a9
commit b5d2db4d9a
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}