From ead5d9cefd8347fb2fe724c84cf23ff5aedf47a8 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 13 Jul 2017 18:12:01 +0900 Subject: [PATCH] eo lexer - handle malloc failure with longjmp handles possible error case nicely --- src/lib/eolian/eo_lexer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/eolian/eo_lexer.c b/src/lib/eolian/eo_lexer.c index f525b41fc8..023dbdf780 100644 --- a/src/lib/eolian/eo_lexer.c +++ b/src/lib/eolian/eo_lexer.c @@ -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;