[lvm-devel] [PATCH 2/3] Remove useless memory allocation for pv->vg_name in _alloc_pv().
Dave Wysochanski
dwysocha at redhat.com
Wed Jan 20 18:19:41 UTC 2010
All this seems to do is provide a memory leak so remove it.
The only caller of _alloc_pv() later explicitly sets
pv->vg_name = fmt->orphan_vg_name so clearly this allocation
should be removed. I also saw no where in the code where
strncpy was used to assign pv->vg_name - only direct assignments
and strdup's.
Signed-off-by: Dave Wysochanski <dwysocha at redhat.com>
---
lib/metadata/metadata.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index f464cf8..a03194e 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1444,11 +1444,6 @@ static struct physical_volume *_alloc_pv(struct dm_pool *mem, struct device *dev
if (!pv)
return_NULL;
- if (!(pv->vg_name = dm_pool_zalloc(mem, NAME_LEN))) {
- dm_pool_free(mem, pv);
- return NULL;
- }
-
pv->pe_size = 0;
pv->pe_start = 0;
pv->pe_count = 0;
--
1.6.0.6
More information about the lvm-devel
mailing list