diff --git a/src/scan.l b/src/scan.l index 4e24ba8a..bd67e9cd 100644 --- a/src/scan.l +++ b/src/scan.l @@ -151,15 +151,17 @@ infnan "+inf.0"|"-inf.0"|"+nan.0"|"-nan.0" BEGIN(BYTEVECTOR); yylval.blob.len = 0; yylval.blob.capa = 10; - yylval.blob.dat = calloc(10, 1); + yylval.blob.dat = yyalloc(10, yyscanner); } [ \r\n\t] { /* skip whitespace */ } {uinteger} { int i = atoi(yytext); - if (0 > i || i > 255) + if (0 > i || i > 255) { + yyfree(yylval.blob.dat, yyscanner); REJECT; + } yylval.blob.dat[yylval.blob.len++] = (char)i; if (yylval.blob.len > yylval.blob.capa) { yylval.blob.capa *= 2;