summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-13 18:12:01 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-16 15:56:02 +0900
commitead5d9cefd8347fb2fe724c84cf23ff5aedf47a8 (patch)
tree2d42c51fc7a697325c55e012a6cb2506b523a419
parentff67dd25e3c306f4e52ce44dba6c5037d7c51fa7 (diff)
downloadefl-ead5d9cefd8347fb2fe724c84cf23ff5aedf47a8.tar.gz
eo lexer - handle malloc failure with longjmp
handles possible error case nicely
-rw-r--r--src/lib/eolian/eo_lexer.c5
1 files changed, 5 insertions, 0 deletions
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;