fixing memory leak issue and removing c90 issue

This commit is contained in:
Ahmed Abdellah
2019-10-24 09:39:16 +01:00
parent 8cbe42fcb0
commit f43e45954f
2 changed files with 10 additions and 9 deletions
+3
View File
@@ -308,6 +308,7 @@ void UTIL_freeFileNamesTable(FileNamesTable* table) {
}
static size_t getTotalTableSize(FileNamesTable* table) {
UTIL_DISPLAY("[TRACE] getTotalTableSize \n");
size_t i = 0, totalSize = 0;
for(i = 0 ; i < table->tableSize && table->fileNames[i] ; ++i) {
totalSize += strlen(table->fileNames[i]) + 1; /* +1 to add '\0' at the end of each fileName */
@@ -324,6 +325,8 @@ UTIL_concatenateTwoTables(FileNamesTable* table1, FileNamesTable* table2) {
FileNamesTable* newTable = (FileNamesTable*) malloc(sizeof(FileNamesTable));
UTIL_DISPLAY("[TRACE] newTable created\n");
if(!newTable) {
UTIL_DISPLAYLEVEL(1, "[ERROR][UTIL_concatenateTwoTables] Can't create new table for concatenation output.\n");
return NULL;