Skip to contentSkip to conversation

libmultipath: free allocated value in set_int

PATCH In review Benjamin Marzinski 2 participants 4 messages Oct 11, 2018 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH 1/2 libmultipath: free allocated value in set_int

set_int() needs to free the buffer it got back from set_value()

Fixes 8f9ac30d ("libmultipath: fix set_int error path")
---
 libmultipath/dict.c | 1 +
 1 file changed, 1 insertion(+)
libmultipath/dict.c +1 -0
index bf4701e..c3f5a6e 100644
@@ -39,6 +39,7 @@ set_int(vector strvec, void *ptr)
 
 	*int_ptr = atoi(buff);
 
+	FREE(buff);
 	return 0;
 }
 
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 2/2 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")
---
 kpartx/devmapper.c | 1 +
 1 file changed, 1 insertion(+)
kpartx/devmapper.c +1 -0
index 8db1eb5..3aa4988 100644
@@ -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;
 	}
Signature · 1 line
2.7.4
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] kpartx: fix new memory leak in dm_find_part

Quoted 4 lines · Benjamin Marzinski

While commit 960bb238 fixed one memory leak, it created another.

Fixes 960bb238 ("kpartx: Fix memory leak of uuid found by coverity")
Quoted 17 lines
---
 kpartx/devmapper.c | 1 +
 1 file changed, 1 insertion(+)
kpartx/devmapper.c +1 -0
index 8db1eb5..3aa4988 100644
@@ -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;

}

Signature · 9 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Reviewed-by on v1 1/2
#3 lore raw
In reply to Benjamin Marzinski
Quoted 4 lines · Benjamin Marzinski

set_int() needs to free the buffer it got back from set_value()

Fixes 8f9ac30d ("libmultipath: fix set_int error path")
Signature · 9 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel