output-item: Fix memory leak in output_item_dump().
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 1 Jan 2022 21:31:39 +0000 (13:31 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 13 Mar 2022 23:56:02 +0000 (16:56 -0700)
src/output/output-item.c

index 0c60b8dc269f39799e2aeeff41825084b318bc97..02aca446363f7d88395dfafa1aa161fad9606cbe 100644 (file)
@@ -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;
     }
 }