Fix: field-class.c: dereference before `NULL` check
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 16 Aug 2019 18:24:27 +0000 (14:24 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 16 Aug 2019 20:05:15 +0000 (16:05 -0400)
Found by Coverity Scan.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iaf80ac22f38e3a9dc5d09a69ac5729ece7cdd2f3
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1957
Tested-by: jenkins <jenkins@lttng.org>
src/lib/trace-ir/field-class.c

index 97409dc98222e21d68a673395a7b1d7d71dc8d5e..610f8f7515b26f187af04d613b2cab49251842e0 100644 (file)
@@ -799,9 +799,8 @@ void destroy_named_field_class(gpointer ptr)
 {
        struct bt_named_field_class *named_fc = ptr;
 
-       BT_OBJECT_PUT_REF_AND_RESET(named_fc->user_attributes);
-
        if (ptr) {
+               BT_OBJECT_PUT_REF_AND_RESET(named_fc->user_attributes);
                finalize_named_field_class(ptr);
                g_free(ptr);
        }
This page took 0.027118 seconds and 4 git commands to generate.