aports/community/babeltrace/gcc12.patch
psykose 663093cfd3 community/babeltrace: fix build with gcc12
fixes:
object.h:141:26: error: null pointer dereference [-Werror=null-dereference]
  141 |                 if (child->parent) {
      |                     ~~~~~^~~~~~~~
object.h:141:26: error: null pointer dereference [-Werror=null-dereference]
cc1: all warnings being treated as errors
2022-10-26 20:49:50 +02:00

23 lines
585 B
Diff

diff --git a/src/ctf-writer/object.h b/src/ctf-writer/object.h
index 70032c2..9e4552a 100644
--- a/src/ctf-writer/object.h
+++ b/src/ctf-writer/object.h
@@ -138,11 +138,13 @@ void bt_ctf_object_set_parent(struct bt_ctf_object *child, struct bt_ctf_object
child->parent = parent;
bt_ctf_object_get_no_null_check(parent);
} else {
- if (child->parent) {
- bt_ctf_object_put_no_null_check(child->parent);
- }
+ if (child) {
+ if (child->parent) {
+ bt_ctf_object_put_no_null_check(child->parent);
+ }
- child->parent = NULL;
+ child->parent = NULL;
+ }
}
}