From 98eaa7c98e66417bf6b0981d4b2fd81f776fe13b Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 22 Jun 2018 22:20:51 -0400 Subject: [PATCH] libsupport: fix memory leak in error path in quota_compute_usage() Fixes-Coverity-Bug: 1362023 Signed-off-by: Theodore Ts'o --- lib/support/mkquota.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c index efc37cb..d136a91 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); -- 1.8.3.1