From 9eea0107ba57aba78fb126794cfbf5110273864c Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 17 Sep 2007 16:02:46 +0000 Subject: [PATCH] Fix strdup memory leak in str_list_dup(). --- WHATS_NEW | 1 + lib/datastruct/str_list.c | 2 +- lib/metadata/metadata.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 57090eafc..1dbca0695 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.29 - ================================== + Fix strdup memory leak in str_list_dup(). Avoid static link failure with some SELinux libraries. Diagnose invalid PE values given on the pvmove command line (64-bit systems). Include strerror string in dev_open_flags' stat failure message. diff --git a/lib/datastruct/str_list.c b/lib/datastruct/str_list.c index 3c259cd25..1d8c2e637 100644 --- a/lib/datastruct/str_list.c +++ b/lib/datastruct/str_list.c @@ -74,7 +74,7 @@ int str_list_dup(struct dm_pool *mem, struct list *sllnew, list_init(sllnew); 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; return 0; } diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 25dee4659..e9d83ec8a 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -908,6 +908,7 @@ static struct physical_volume *_find_pv_by_name(struct cmd_context *cmd, return NULL; } + /* FIXME Can fail when no PV mda */ if (!pv->vg_name[0]) { log_error("Physical volume %s not in a volume group", pv_name); return NULL;