Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] [PATCH babeltrace] Fix: Added a null pointer check to bt_ctf_field_name.
Date: Mon, 28 Jan 2013 10:36:07 +0000	[thread overview]
Message-ID: <1359369367-12876-1-git-send-email-jeremie.galarneau@efficios.com> (raw)

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 at efficios.com>
---
 formats/ctf/events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/formats/ctf/events.c b/formats/ctf/events.c
index ac7dce4..182d0de 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));
-- 
1.8.1.1




             reply	other threads:[~2013-01-28 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 10:36 Jérémie Galarneau [this message]
2013-01-28 16:09 ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359369367-12876-1-git-send-email-jeremie.galarneau@efficios.com \
    --to=jeremie.galarneau@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox