summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-06-22 22:20:51 -0400
committerTheodore Ts'o <tytso@mit.edu>2018-06-22 22:20:51 -0400
commit98eaa7c98e66417bf6b0981d4b2fd81f776fe13b (patch)
tree2a1275d9f7f3e56f43ffa22754cbb3e2919153dd
parent267ff15d446076b9274bc275cc1f61922bb5d198 (diff)
downloade2fsprogs-98eaa7c98e66417bf6b0981d4b2fd81f776fe13b.tar.gz
libsupport: fix memory leak in error path in quota_compute_usage()
Fixes-Coverity-Bug: 1362023 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/support/mkquota.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index efc37cb4..d136a915 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -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);