Whamcloud - gitweb
libext2fs: fix memory leak when failing to iterate inline_data directory
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 10 Aug 2014 22:32:21 +0000 (18:32 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 10 Aug 2014 22:32:21 +0000 (18:32 -0400)
The xattr_get method returns to us a pointer to a buffer containing
the EA value.  If for some reason we decide to fail out of iterating
the EA part of an inline-data directory, we must free the buffer that
xattr_get passed to us (via inline_data_ea_get).

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/inline_data.c

index 3ba04ae..7eb8b94 100644 (file)
@@ -218,7 +218,7 @@ int ext2fs_inline_data_dir_iterate(ext2_filsys fs, ext2_ino_t ino,
                goto out;
        }
        if (data.ea_size <= 0)
-               goto out;
+               goto out1;
 
        ctx->buf = data.ea_data;
        ctx->buflen = data.ea_size;
@@ -226,7 +226,7 @@ int ext2fs_inline_data_dir_iterate(ext2_filsys fs, ext2_ino_t ino,
        ctx->errcode = ext2fs_dirent_swab_in2(fs, ctx->buf, ctx->buflen, 0);
        if (ctx->errcode) {
                ret |= BLOCK_ABORT;
-               goto out;
+               goto out1;
        }
 #endif