From 9e0e1c7a885e0c906478887655ae556ef082dd73 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 4 Jan 2023 12:28:44 +0100 Subject: [PATCH] libmount: fix memory leak [coverity scan] Signed-off-by: Karel Zak --- libmount/src/context_umount.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 7b4e456a52..efb6675b3a 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -645,8 +645,10 @@ static int evaluate_permissions(struct libmnt_context *cxt) /* get "user=" from utab */ ol = mnt_context_get_optlist(cxt); - if (!ol) + if (!ol) { + free(curr_user); return -ENOMEM; + } opt = mnt_optlist_get_named(ol, "user", cxt->map_userspace); if (opt && mnt_opt_has_value(opt)) ok = !strcmp(curr_user, mnt_opt_get_value(opt)); -- 2.47.2