Whamcloud - gitweb
ext2fs: fix memory leak in an error case in inode_open()
authorTheodore Ts'o <tytso@mit.edu>
Tue, 21 Dec 2010 23:05:07 +0000 (18:05 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 21 Dec 2010 23:05:07 +0000 (18:05 -0500)
Reported-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/inode_io.c

index 4faaa48..b3e7ce5 100644 (file)
@@ -163,9 +163,10 @@ static errcode_t inode_open(const char *name, int flags, io_channel *channel)
        return 0;
 
 cleanup:
-       if (data) {
+       if (io->name)
+               ext2fs_free_mem(&io->name);
+       if (data)
                ext2fs_free_mem(&data);
-       }
        if (io)
                ext2fs_free_mem(&io);
        return retval;