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:08:53 +0000 (11:08 -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 ac7dce46828daf103adea381e30e2c84f31f50ab..182d0dedf68a43b440130eda4d28b7debc01d974 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)
 {
 
 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));
                return NULL;
 
        return rem_(g_quark_to_string(def->name));
This page took 0.024876 seconds and 4 git commands to generate.