[dm-devel] [PATCH] Memory leak in ev_add_map.
Konrad Rzeszutek
konrad at virtualiron.com
Tue Dec 16 15:54:56 UTC 2008
From: Konrad Rzeszutek <konrad at mars.virtualiron.com>
When using dm_mapname it makes a strdup of the returned value. We use
the dm_mapname return value (alias) in our function but neglected
to free it at the exit points.
---
multipathd/main.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 30dba5b..e8a2660 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -243,6 +243,7 @@ ev_add_map (struct sysfs_device * dev, struct vectors * vecs)
if (map_present && dm_type(alias, TGT_MPATH) <= 0) {
condlog(4, "%s: not a multipath map", alias);
+ FREE(alias);
return 0;
}
@@ -256,6 +257,7 @@ ev_add_map (struct sysfs_device * dev, struct vectors * vecs)
*/
condlog(0, "%s: devmap already registered",
dev->kernel);
+ FREE(alias);
return 0;
}
@@ -280,6 +282,7 @@ ev_add_map (struct sysfs_device * dev, struct vectors * vecs)
condlog(0, "%s: uev_add_map %s failed", alias, dev->kernel);
FREE(refwwid);
+ FREE(alias);
return r;
}
--
1.5.4.1
More information about the dm-devel
mailing list