diff options
author | Karel Zak | 2019-05-15 17:25:04 +0200 |
---|---|---|
committer | Karel Zak | 2019-05-15 17:25:04 +0200 |
commit | cb400752a4114c0c904c20253ed5ee68c11dc326 (patch) | |
tree | 37f1e5704b5b2feb5f5cd8b59ae7977978f50f01 | |
parent | libfdisk: avoid memory leak [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-cb400752a4114c0c904c20253ed5ee68c11dc326.tar.gz kernel-qcow2-util-linux-cb400752a4114c0c904c20253ed5ee68c11dc326.tar.xz kernel-qcow2-util-linux-cb400752a4114c0c904c20253ed5ee68c11dc326.zip |
libmount: fix memory leak on error [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libmount/src/context_umount.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 7c5893ae6..999cdb016 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -574,9 +574,10 @@ static int evaluate_permissions(struct libmnt_context *cxt) curr_user = mnt_get_username(getuid()); - if (!mnt_context_switch_ns(cxt, ns_old)) + if (!mnt_context_switch_ns(cxt, ns_old)) { + free(curr_user); return -MNT_ERR_NAMESPACE; - + } if (!curr_user) { DBG(CXT, ul_debugobj(cxt, "umount %s: cannot " "convert %d to username", tgt, getuid())); |