eo lexer - handle malloc failure with longjmp

handles possible error case nicely
This commit is contained in:
Carsten Haitzler 2017-07-13 18:12:01 +09:00
parent ff67dd25e3
commit ead5d9cefd
1 changed files with 5 additions and 0 deletions

View File

@ -1252,6 +1252,11 @@ void
eo_lexer_context_push(Eo_Lexer *ls)
{
Lexer_Ctx *ctx = malloc(sizeof(Lexer_Ctx));
if (!ctx)
{
fprintf(stderr, "eolian: out of memory pushing context\n");
longjmp(ls->err_jmp, EINA_TRUE);
}
ctx->line = ls->line_number;
ctx->column = ls->column;
ctx->linestr = ls->stream_line;