[dm-devel] [PATCH 06/39] libmultipath: memory leak in add_map_without_path()
Hannes Reinecke
hare at suse.de
Thu Jun 16 09:47:12 UTC 2016
If we call add_map_without_path() with an empty alias the
mpp structure is never freed.
Found by coverity.
Signed-off-by: Hannes Reinecke <hare at suse.com>
---
libmultipath/structs_vec.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index e992b54..20a7457 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -414,8 +414,12 @@ add_map_without_path (struct vectors * vecs, char * alias)
{
struct multipath * mpp = alloc_multipath();
- if (!mpp || !alias)
+ if (!mpp)
+ return NULL;
+ if (!alias) {
+ FREE(mpp);
return NULL;
+ }
mpp->alias = STRDUP(alias);
--
2.6.6
More information about the dm-devel
mailing list