fs/squashfs: sqfs_read: fix memory leak

sqfs_closedir() should be called to free memory allocated by
sqfs_opendir()

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
This commit is contained in:
Richard Genoud 2020-11-03 12:11:13 +01:00 committed by Tom Rini
parent b34949fe9b
commit 7ce9745cbe

View File

@ -1341,7 +1341,6 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
if (ret) {
printf("File not found.\n");
*actread = 0;
sqfs_closedir(dirsp);
ret = -ENOENT;
goto free_paths;
}
@ -1532,6 +1531,7 @@ free_datablk:
free_paths:
free(file);
free(dir);
sqfs_closedir(dirsp);
return ret;
}