From: Vegard Nossum <vegard.nossum@gmail.com>
To: linux-sparse@vger.kernel.org
Subject: [PATCH] Set *tree to NULL on error
Date: Sun, 25 May 2008 10:35:00 +0200 [thread overview]
Message-ID: <20080525083500.GA4158@damson.getinternet.no> (raw)
From: Vegard Nossum <vegardno@ifi.uio.no>
Date: Sun, 25 May 2008 10:29:19 +0200
Subject: [PATCH] Set *tree to NULL on error
On "Syntax error in unary expression", the output parameter "tree" would be left
uninitialized and subsequently used in unary_expression(), leading to segfault.
Caught by valgrind and fixed by me ;-)
Signed-off-by: Vegard Nossum <vegardno@ifi.uio.no>
---
expression.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/expression.c b/expression.c
index 289927a..f634b07 100644
--- a/expression.c
+++ b/expression.c
@@ -654,6 +654,7 @@ static struct token *unary_expression(struct token *token, struct expression **t
next = cast_expression(token->next, &unop);
if (!unop) {
sparse_error(token->pos, "Syntax error in unary expression");
+ *tree = NULL;
return next;
}
unary = alloc_expression(token->pos, EXPR_PREOP);
@@ -671,6 +672,7 @@ static struct token *unary_expression(struct token *token, struct expression **t
next = cast_expression(token->next, &unop);
if (!unop) {
sparse_error(token->pos, "Syntax error in unary expression");
+ *tree = NULL;
return next;
}
unary = alloc_expression(token->pos, EXPR_PREOP);
--
1.5.4.1
reply other threads:[~2008-05-25 8:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20080525083500.GA4158@damson.getinternet.no \
--to=vegard.nossum@gmail.com \
--cc=linux-sparse@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).