From 86c58c4a8201251bd0083d0af8cda4e5610efa48 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 17 Jul 2014 15:12:35 +0200 Subject: umount: fix memory leak [coverity scan] Signed-off-by: Karel Zak --- sys-utils/umount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sys-utils/umount.c') diff --git a/sys-utils/umount.c b/sys-utils/umount.c index a75ff9ec1..8bc6655ea 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); -- cgit v1.2.3-55-g7522