]> Git Repo - linux.git/commitdiff
ext4: fix memleak in ext4_readdir()
authorKirill Tkhai <[email protected]>
Tue, 16 Feb 2016 05:20:19 +0000 (00:20 -0500)
committerTheodore Ts'o <[email protected]>
Tue, 16 Feb 2016 05:20:19 +0000 (00:20 -0500)
When ext4_bread() fails, fname_crypto_str remains
allocated after return. Fix that.

Signed-off-by: Kirill Tkhai <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
CC: Dmitry Monakhov <[email protected]>
fs/ext4/dir.c

index 6d17f31a31d7479cae271f6d043ec9cb475e348e..33f5e2a50cf883c43842e1c89a868fcf70c4c2a9 100644 (file)
@@ -163,8 +163,11 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
                                        index, 1);
                        file->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
                        bh = ext4_bread(NULL, inode, map.m_lblk, 0);
-                       if (IS_ERR(bh))
-                               return PTR_ERR(bh);
+                       if (IS_ERR(bh)) {
+                               err = PTR_ERR(bh);
+                               bh = NULL;
+                               goto errout;
+                       }
                }
 
                if (!bh) {
This page took 0.06068 seconds and 4 git commands to generate.