Skip to content

Commit

Permalink
prevent memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
PironP committed Dec 17, 2017
1 parent 46dba74 commit 4d07b08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sources/sources/read_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void showDatabases()
}
}
}
free(databasePath);
fclose(file);
}

Expand All @@ -51,6 +52,8 @@ Table findAllRecords(char* db_name, char* table_name)
Table currentTable;

if(!filesFound(db_file, table_name, table_file)) {
free(table_file);
free(db_file);
return currentTable;
}

Expand All @@ -70,6 +73,8 @@ Table findAllRecords(char* db_name, char* table_name)
parseData(data, &currentTable);

fclose(f);
free(table_file);
free(db_file);

return currentTable;
}
Expand Down

0 comments on commit 4d07b08

Please sign in to comment.