Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 11 Oct 2018 15:37:52 -0500
Subject: [PATCH] kpartx: fix new memory leak in dm_find_part

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c
index 8db1eb5..3aa4988 100644
--- a/kpartx/devmapper.c
+++ b/kpartx/devmapper.c
@@ -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;
 	}
-- 
2.17.1