projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b4062aa
)
macro: Fix memory leaks in error cases parsing function arguments.
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 9 Oct 2021 16:41:01 +0000
(09:41 -0700)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 9 Oct 2021 16:41:01 +0000
(09:41 -0700)
Found by Address Sanitizer.
src/language/lexer/macro.c
patch
|
blob
|
history
diff --git
a/src/language/lexer/macro.c
b/src/language/lexer/macro.c
index bced649ec3b08481e352db101bd7b8410b6b3e26..a089a3a7c32e1c7538097d0e291d7366d408f46b 100644
(file)
--- a/
src/language/lexer/macro.c
+++ b/
src/language/lexer/macro.c
@@
-1135,7
+1135,10
@@
expand_macro_function (const struct macro_expander *me,
struct string_array args = STRING_ARRAY_INITIALIZER;
size_t n_consumed = parse_function_args (me, input, n_input, mf->name, &args);
if (!n_consumed)
- return 0;
+ {
+ string_array_destroy (&args);
+ return 0;
+ }
if (args.n < mf->min_args || args.n > mf->max_args)
{
@@
-1158,6
+1161,7
@@
expand_macro_function (const struct macro_expander *me,
mf->name);
else
NOT_REACHED ();
+ string_array_destroy (&args);
return 0;
}