From: Karel Zak Date: Thu, 17 Jul 2014 13:12:35 +0000 (+0200) Subject: umount: fix memory leak [coverity scan] X-Git-Tag: v2.25~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86c58c4a8201251bd0083d0af8cda4e5610efa48;p=thirdparty%2Futil-linux.git umount: fix memory leak [coverity scan] Signed-off-by: Karel Zak --- diff --git a/sys-utils/umount.c b/sys-utils/umount.c index a75ff9ec19..8bc6655ea4 100644 --- a/sys-utils/umount.c +++ b/sys-utils/umount.c @@ -445,8 +445,10 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r /* get on @cxt independent mountinfo */ tb = new_mountinfo(cxt); - if (!tb) - return MOUNT_EX_SOFTWARE; + if (!tb) { + rc = MOUNT_EX_SOFTWARE; + goto done; + } /* Note that @fs is from mount context and the context will be reseted * after each umount() call */ @@ -468,6 +470,7 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r break; } +done: mnt_free_iter(itr); mnt_unref_table(tb);