From 33c8e4de33b2b2fced148e04f725af9d350a989a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 14 Nov 2019 16:23:38 +0100 Subject: [PATCH] cov: fix memory leak Reapply 23cc7ddc50e2800a6dc248de897a4c88c1514160 to internal version of libdm. --- device_mapper/libdm-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/device_mapper/libdm-common.c b/device_mapper/libdm-common.c index 1cb29f1e8..bc691d629 100644 --- a/device_mapper/libdm-common.c +++ b/device_mapper/libdm-common.c @@ -2012,7 +2012,8 @@ static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, siz log_sys_error("readlink", sysfs_path); else { log_sys_debug("readlink", sysfs_path); - return _sysfs_find_kernel_name(major, minor, buf, buf_size); + r = _sysfs_find_kernel_name(major, minor, buf, buf_size); + goto out; } goto bad; } @@ -2033,6 +2034,7 @@ static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, siz strcpy(buf, name); r = 1; bad: +out: free(temp_buf); free(sysfs_path); -- 2.43.5