]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (subdir) fix memory leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 4 Jan 2023 12:04:14 +0000 (13:04 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 4 Jan 2023 12:04:14 +0000 (13:04 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/hook_subdir.c

index 2b7a95b34113f17856799cf8dbec65e65dac18f4..77b073a69556d5f317edc74379b971bcd3c3a1fc 100644 (file)
@@ -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));