mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
fix memory leak in list command
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../../mfapi/apicalls.h"
|
||||
#include "../mfshell.h"
|
||||
@@ -52,6 +53,11 @@ int mfshell_cmd_list(mfshell * mfshell, int argc, char *const argv[])
|
||||
printf("%s %s\n", folder_get_name(folder_result[i]), folder_get_key(folder_result[i]));
|
||||
}
|
||||
|
||||
for (i = 0; folder_result[i] != NULL; i++) {
|
||||
folder_free(folder_result[i]);
|
||||
}
|
||||
free(folder_result);
|
||||
|
||||
// then files
|
||||
file_result = NULL;
|
||||
retval =
|
||||
@@ -62,5 +68,10 @@ int mfshell_cmd_list(mfshell * mfshell, int argc, char *const argv[])
|
||||
printf("%s %s\n", file_get_name(file_result[i]), file_get_key(file_result[i]));
|
||||
}
|
||||
|
||||
for (i = 0; file_result[i] != NULL; i++) {
|
||||
file_free(file_result[i]);
|
||||
}
|
||||
free(file_result);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user