fix:no more leaks possible
This commit is contained in:
6
test.c
6
test.c
@@ -73,10 +73,14 @@ int main(void)
|
||||
|
||||
entry = malloc(10*sizeof(struct configEntry));
|
||||
parseConfig(content,&entry,10*sizeof(struct configEntry),&returnedCount);
|
||||
free(content);
|
||||
|
||||
for(i=0;i<returnedCount;i++)
|
||||
{
|
||||
printf("i:%d/%d, struct section: %s, keyname: %s, keyvalue: %s\n",i,returnedCount,entry[i].sectionName,entry[i].keyName,entry[i].keyValue);
|
||||
free(entry[i].keyName);
|
||||
free(entry[i].keyValue);
|
||||
free(entry[i].sectionName);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +89,7 @@ int main(void)
|
||||
free(keyValue);
|
||||
free(keyName);
|
||||
free(name);
|
||||
free(entry->keyName);
|
||||
free(entry);
|
||||
free(sectionName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user