Fix: destroy_pretty_data: move NULL check earlier
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 15 Oct 2019 18:32:00 +0000 (14:32 -0400)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 15 Oct 2019 19:12:08 +0000 (15:12 -0400)
Move the NULL check for pretty before we dereference it.

Reported-by: Coverity
Change-Id: I2e598e734d4503ec17754dabf915d8264edcf4a7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2179
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/text/pretty/pretty.c

index a925b7d8fce9b9c9b936ef535b0e007d2b253882..3ea6c54ad4be2316d99ebd93c2db34ee52c7bbe9 100644 (file)
@@ -46,12 +46,12 @@ const char * const in_port_name = "in";
 static
 void destroy_pretty_data(struct pretty_component *pretty)
 {
-       bt_self_component_port_input_message_iterator_put_ref(pretty->iterator);
-
        if (!pretty) {
                goto end;
        }
 
+       bt_self_component_port_input_message_iterator_put_ref(pretty->iterator);
+
        if (pretty->string) {
                (void) g_string_free(pretty->string, TRUE);
        }
This page took 0.02423 seconds and 4 git commands to generate.