From 88c547d1ca83426f4de5371baac885f5500b5487 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 13 Oct 2012 19:15:15 +0200 Subject: [PATCH] lvmetad: move initialization in the inner loop Set append to NULL in the front of cycle, so the INTERNAL error path is not leading to double-free of append pointer. --- libdaemon/client/config-util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c index 9b893c61c..1f4b55b3e 100644 --- a/libdaemon/client/config-util.c +++ b/libdaemon/client/config-util.c @@ -23,7 +23,7 @@ int buffer_append_vf(struct buffer *buf, va_list ap) { - char *append = NULL; + char *append; char *next; int keylen; int64_t value; @@ -31,6 +31,7 @@ int buffer_append_vf(struct buffer *buf, va_list ap) char *block; while ((next = va_arg(ap, char *))) { + append = NULL; if (!strchr(next, '=')) { log_error(INTERNAL_ERROR "Bad format string at '%s'", next); goto fail;