* [PATCH] Set *tree to NULL on error
@ 2008-05-25 8:35 Vegard Nossum
0 siblings, 0 replies; only message in thread
From: Vegard Nossum @ 2008-05-25 8:35 UTC (permalink / raw)
To: linux-sparse
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-05-25 8:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-25 8:35 [PATCH] Set *tree to NULL on error Vegard Nossum
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).