Whamcloud - gitweb
libext2fs: fix memory leak in error path while opening test_io manager
authorzhanchengbin <zhanchengbin1@huawei.com>
Fri, 31 Dec 2021 07:43:36 +0000 (15:43 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 May 2022 00:56:42 +0000 (20:56 -0400)
Link: https://lore.kernel.org/r/d0632bbc-9713-38a9-c914-137b702f6ae1@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/test_io.c
lib/ext2fs/undo_io.c

index 480e68f..6843edb 100644 (file)
@@ -248,6 +248,8 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel)
        return 0;
 
 cleanup:
+       if (io && io->name)
+               ext2fs_free_mem(&io->name);
        if (io)
                ext2fs_free_mem(&io);
        if (data)
index eb56f53..f4a6d52 100644 (file)
@@ -790,6 +790,8 @@ cleanup:
                io_channel_close(data->real);
        if (data)
                ext2fs_free_mem(&data);
+       if (io && io->name)
+               ext2fs_free_mem(&io->name);
        if (io)
                ext2fs_free_mem(&io);
        return retval;