yaffs-vfs-multi.c: Handle search context properly to prevent leaking master
authorCharles Manning <cdhmanning@gmail.com>
Thu, 25 Jun 2020 04:01:27 +0000 (16:01 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Thu, 25 Jun 2020 04:01:27 +0000 (16:01 +1200)
Fix potential memory leak due to search context not being closed properly.

Thank you to George Pee for reporting this issue.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_vfs_multi.c

index 3044db7..19c8919 100644 (file)
@@ -1832,10 +1832,8 @@ static int yaffs_iterate(struct file *f, struct dir_context *dc)
                goto out;
        }
 
-       if (!dir_emit_dots(f, dc)) {
-               yaffs_gross_unlock(dev);
-               return 0;
-       }
+       if (!dir_emit_dots(f, dc))
+               goto out;
 
        curoffs = 1;