From 00a0a46dcdb3bf9e93200a145df94ff24d2d35d4 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 30 Mar 2016 12:04:54 +0200 Subject: [PATCH] Avoid possible memory allocation error on erroneous input. Valgrind showed a possible problem here. --- src/language/stats/npar.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/language/stats/npar.c b/src/language/stats/npar.c index 22d95c025a..7c2b37af15 100644 --- a/src/language/stats/npar.c +++ b/src/language/stats/npar.c @@ -692,8 +692,12 @@ npar_runs (struct lexer *lexer, struct dataset *ds, return 0; } - lex_force_match (lexer, T_RPAREN); - lex_force_match (lexer, T_EQUALS); + if (! lex_force_match (lexer, T_RPAREN)) + return 2; + + if (! lex_force_match (lexer, T_EQUALS)) + return 2; + if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds), &tp->vars, &tp->n_vars, PV_NO_SCRATCH | PV_NO_DUPLICATE | PV_NUMERIC)) -- 2.30.2