Whamcloud - gitweb
libsupport: fix memory leak in error path in quota_compute_usage()
authorTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jun 2018 02:20:51 +0000 (22:20 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 23 Jun 2018 02:20:51 +0000 (22:20 -0400)
Fixes-Coverity-Bug: 1362023
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/support/mkquota.c

index efc37cb..d136a91 100644 (file)
@@ -484,8 +484,10 @@ errcode_t quota_compute_usage(quota_ctx_t qctx)
        }
        inode_size = fs->super->s_inode_size;
        inode = malloc(inode_size);
-       if (!inode)
+       if (!inode) {
+               ext2fs_close_inode_scan(scan);
                return ENOMEM;
+       }
        while (1) {
                ret = ext2fs_get_next_inode_full(scan, &ino,
                                                 EXT2_INODE(inode), inode_size);