From: Jérémie Galarneau Date: Mon, 28 Jan 2013 16:06:59 +0000 (-0500) Subject: Fix: Added a null pointer check to bt_ctf_field_name X-Git-Tag: v1.2.0-rc1~81 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=338a0747b5833f1615fe709b9d36bab4d9ae646e;ds=sidebyside Fix: Added a null pointer check to bt_ctf_field_name 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 Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/events.c b/formats/ctf/events.c index ac7dce46..182d0ded 100644 --- a/formats/ctf/events.c +++ b/formats/ctf/events.c @@ -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));