From faa4f310af58bc1dfd56be0575745c91a59d88b3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 1 Jan 2022 13:31:39 -0800 Subject: [PATCH] output-item: Fix memory leak in output_item_dump(). --- src/output/output-item.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/output/output-item.c b/src/output/output-item.c index 0c60b8dc26..02aca44636 100644 --- a/src/output/output-item.c +++ b/src/output/output-item.c @@ -364,9 +364,12 @@ output_item_dump (const struct output_item *item, int indentation) break; case OUTPUT_ITEM_TEXT: - printf ("text %s \"%s\"\n", - text_item_subtype_to_string (item->text.subtype), - pivot_value_to_string_defaults (item->text.content)); + { + char *s = pivot_value_to_string_defaults (item->text.content); + printf ("text %s \"%s\"\n", + text_item_subtype_to_string (item->text.subtype), s); + free (s); + } break; } } -- 2.30.2