From be6161f17efdedc99e69763a68a1231d45603203 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 4 Jan 2023 13:04:14 +0100 Subject: [PATCH] libmount: (subdir) fix memory leak [coverity scan] Signed-off-by: Karel Zak --- libmount/src/hook_subdir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libmount/src/hook_subdir.c b/libmount/src/hook_subdir.c index 2b7a95b341..77b073a695 100644 --- a/libmount/src/hook_subdir.c +++ b/libmount/src/hook_subdir.c @@ -332,9 +332,10 @@ static int hook_prepare_target( /* create a global data */ struct hookset_data *hsd = new_hookset_data(cxt, hs); - if (!hsd) + if (!hsd) { + free(subdir); return -ENOMEM; - + } hsd->subdir = subdir; DBG(HOOK, ul_debugobj(hs, "subdir %s wanted", subdir)); -- 2.47.3