1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix strdup memory leak in str_list_dup().

This commit is contained in:
Alasdair Kergon 2007-09-17 16:02:46 +00:00
parent 7d6a7e7d3b
commit 9eea0107ba
3 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.29 - Version 2.02.29 -
================================== ==================================
Fix strdup memory leak in str_list_dup().
Avoid static link failure with some SELinux libraries. Avoid static link failure with some SELinux libraries.
Diagnose invalid PE values given on the pvmove command line (64-bit systems). Diagnose invalid PE values given on the pvmove command line (64-bit systems).
Include strerror string in dev_open_flags' stat failure message. Include strerror string in dev_open_flags' stat failure message.

View File

@ -74,7 +74,7 @@ int str_list_dup(struct dm_pool *mem, struct list *sllnew,
list_init(sllnew); list_init(sllnew);
list_iterate_items(sl, sllold) { list_iterate_items(sl, sllold) {
if (!str_list_add(mem, sllnew, strdup(sl->str))) { if (!str_list_add(mem, sllnew, dm_pool_strdup(mem, sl->str))) {
stack; stack;
return 0; return 0;
} }

View File

@ -908,6 +908,7 @@ static struct physical_volume *_find_pv_by_name(struct cmd_context *cmd,
return NULL; return NULL;
} }
/* FIXME Can fail when no PV mda */
if (!pv->vg_name[0]) { if (!pv->vg_name[0]) {
log_error("Physical volume %s not in a volume group", pv_name); log_error("Physical volume %s not in a volume group", pv_name);
return NULL; return NULL;