All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
To: lttng-dev@lists.lttng.org
Cc: jgalar@efficios.com
Subject: [PATCH lttng-tools] Fix: null dereference on error path for create_ctx_type
Date: Tue, 17 Jan 2017 10:08:47 -0500	[thread overview]
Message-ID: <1484665727-24204-1-git-send-email-jonathan.rajotte-julien__21664.768344681$1484665764$gmane$org@efficios.com> (raw)

When zmalloc of type->opt fail the destroy_ctx_type would result in a
null dereference.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
---
 src/bin/lttng/commands/add_context.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c
index 5fc65bf..df722bb 100644
--- a/src/bin/lttng/commands/add_context.c
+++ b/src/bin/lttng/commands/add_context.c
@@ -662,7 +662,9 @@ void destroy_ctx_type(struct ctx_type *type)
 	if (!type) {
 		return;
 	}
-	free(type->opt->symbol);
+	if (type->opt) {
+		free(type->opt->symbol);
+	}
 	free(type->opt);
 	free(type);
 }
-- 
2.7.4

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

             reply	other threads:[~2017-01-17 15:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17 15:08 Jonathan Rajotte [this message]
     [not found] <1484665727-24204-1-git-send-email-jonathan.rajotte-julien@efficios.com>
2017-01-26  0:32 ` [PATCH lttng-tools] Fix: null dereference on error path for create_ctx_type Jérémie Galarneau

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='1484665727-24204-1-git-send-email-jonathan.rajotte-julien__21664.768344681$1484665764$gmane$org@efficios.com' \
    --to=jonathan.rajotte-julien@efficios.com \
    --cc=jgalar@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.