Fixed memory leaks
Several tests had memory leaks. As well found a few leaks within the importer and resolver areas.
This commit is contained in:
parent
61d0adc445
commit
9882c28743
4 changed files with 37 additions and 4 deletions
|
@ -268,12 +268,14 @@ int ipfs_import_file(const char* root_dir, const char* fileName, struct Node** p
|
|||
free(file);
|
||||
if (path != NULL)
|
||||
free (path);
|
||||
os_utils_free_file_list(first);
|
||||
} else {
|
||||
// process this file
|
||||
FILE* file = fopen(fileName, "rb");
|
||||
retVal = ipfs_node_new(parent_node);
|
||||
if (retVal == 0)
|
||||
if (retVal == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// add all nodes (will be called multiple times for large files)
|
||||
while ( bytes_read == MAX_DATA_SIZE) {
|
||||
|
@ -345,6 +347,8 @@ int ipfs_import_files(int argc, char** argv) {
|
|||
ipfs_import_print_node_results(directory_entry, filename);
|
||||
// cleanup
|
||||
ipfs_node_free(directory_entry);
|
||||
free(path);
|
||||
free(filename);
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue