Skip to content

Commit

Permalink
Also free the tableList
Browse files Browse the repository at this point in the history
With this patch all the leaks should be gone
  • Loading branch information
egli committed May 21, 2014
1 parent 63dd676 commit 1562279
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions liblouis/compileTranslationTable.c
Expand Up @@ -4775,7 +4775,17 @@ compileFile (const char *fileName)
return 0;
}

/*
/**
* Macro to free a char** array
*/
#define free_tablelist(list) { \
char **string; \
for (string = list; *string; string++) \
free(*string); \
free(list); \
}

/**
* Implement include opcode
*
*/
Expand Down Expand Up @@ -4804,7 +4814,7 @@ includeFile (FileInfo * nested, CharsString * includedFile)
return 0;
}
rv = compileFile (*tableFiles);
free(tableFiles);
free_tablelist(tableFiles);
return rv;
}

Expand Down Expand Up @@ -4850,7 +4860,7 @@ compileTranslationTable (const char *tableList)

/* Clean up after compiling files */
cleanup:
free(tableFiles);
free_tablelist(tableFiles);
if (characterClasses)
deallocateCharacterClasses ();
if (ruleNames)
Expand Down

0 comments on commit 1562279

Please sign in to comment.