Avoid possible memory allocation error on erroneous input.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 30 Mar 2016 10:04:54 +0000 (12:04 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 30 Mar 2016 10:04:54 +0000 (12:04 +0200)
Valgrind showed a possible problem here.

src/language/stats/npar.c

index 22d95c025a5beac60f24ccb48cf17bf8a128f28b..7c2b37af1524d4324d16c1a1f8300cb9c39bdddd 100644 (file)
@@ -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))