Fix: Added a null pointer check to bt_ctf_field_name
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 28 Jan 2013 16:06:59 +0000 (11:06 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 28 Jan 2013 16:06:59 +0000 (11:06 -0500)
This function is called indirectly when calling __repr__ (print) in the
python bindings on the definition object returned by the
get_top_level_scope method thus resulting in a segmentation fault when
the name attribute is not set.

Fixes #373

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/events.c

index 5a6f6255b7eed0b33e498bdbca061390daacd8d6..ff0fcb302864dbb520daa01285b5facebab1bade 100644 (file)
@@ -168,7 +168,7 @@ const char *bt_ctf_event_name(const struct bt_ctf_event *ctf_event)
 
 const char *bt_ctf_field_name(const struct definition *def)
 {
-       if (!def)
+       if (!def || !def->name)
                return NULL;
 
        return rem_(g_quark_to_string(def->name));
This page took 0.026699 seconds and 4 git commands to generate.