Skip to contentSkip to conversation

LVM2/lib/metadata metadata.c

PATCH [email protected] 1 participant 1 message Jan 21, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-01-21 21:04:44

Modified files:
lib/metadata : metadata.c

Log message:

	Remove useless memory allocation for pv->vg_name in _alloc_pv().
	
	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.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.310&r2=1.311

lib/metadata/metadata.c +0 -5
@@ -1443,11 +1443,6 @@
 	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;