kpartx: fix new memory leak in dm_find_part
authorBenjamin Marzinski <bmarzins@redhat.com>
Thu, 11 Oct 2018 20:43:48 +0000 (15:43 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 12 Oct 2018 07:36:35 +0000 (09:36 +0200)
While commit 960bb238 fixed one memory leak, it created another.

Fixes: 960bb238 ("kpartx: Fix memory leak of uuid found by coverity")
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
kpartx/devmapper.c

index 8db1eb5..3aa4988 100644 (file)
@@ -690,6 +690,7 @@ int dm_find_part(const char *parent, const char *delim, int part,
 
        r = dm_rename(tmp, name);
        if (r == 1) {
+               free(tmp);
                *part_uuid = uuid;
                return 1;
        }