text.pretty: create an event string instead of using fprintf()/fputs()
[babeltrace.git] / plugins / text / pretty / pretty.c
index d7346de1ed92bd202dbd37a34c9ffa8ee39d3e0c..9c994095871e556d149edf0fef49bdbe50482b00 100644 (file)
@@ -80,7 +80,15 @@ static
 void destroy_pretty_data(struct pretty_component *pretty)
 {
        bt_put(pretty->input_iterator);
-       (void) g_string_free(pretty->string, TRUE);
+
+       if (pretty->string) {
+               (void) g_string_free(pretty->string, TRUE);
+       }
+
+       if (pretty->tmp_string) {
+               (void) g_string_free(pretty->tmp_string, TRUE);
+       }
+
        if (pretty->out != stdout) {
                int ret;
 
@@ -106,6 +114,10 @@ struct pretty_component *create_pretty(void)
        if (!pretty->string) {
                goto error;
        }
+       pretty->tmp_string = g_string_new("");
+       if (!pretty->tmp_string) {
+               goto error;
+       }
 end:
        return pretty;
 
This page took 0.023757 seconds and 4 git commands to generate.