From 1f0530919e5488db372e4c747d4b3ef00b57c12c Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 23 Oct 2024 19:21:05 +0200 Subject: [PATCH] export: typo with buffer zeroing Lost '= 0' in cut & paste. Also get rid of no longer needed 'goto' section. --- lib/format_text/export.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/format_text/export.c b/lib/format_text/export.c index ba58e4cd4..7310f945c 100644 --- a/lib/format_text/export.c +++ b/lib/format_text/export.c @@ -394,22 +394,19 @@ static char *_alloc_printed_str_list(struct dm_list *list) return NULL; } - buffer[0]; + buffer[0] = 0; dm_list_iterate_items(sl, list) { if (!emit_to_buffer(&buf, &size, "%s\"%s\"", (!first) ? ", " : "", - sl->str)) - goto_bad; - + sl->str)) { + free(buffer); + return_NULL; + } first = 0; } return buffer; - -bad: - free(buffer); - return_NULL; } static int _out_list(struct formatter *f, struct dm_list *list,