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>
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 1ac0762..a9e803c 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -1341,7 +1341,6 @@
if (ret) {
printf("File not found.\n");
*actread = 0;
- sqfs_closedir(dirsp);
ret = -ENOENT;
goto free_paths;
}
@@ -1532,6 +1531,7 @@
free_paths:
free(file);
free(dir);
+ sqfs_closedir(dirsp);
return ret;
}