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)
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
1252eo_lexer_context_push(Eo_Lexer *ls) 1252eo_lexer_context_push(Eo_Lexer *ls)
1253{ 1253{
1254 Lexer_Ctx *ctx = malloc(sizeof(Lexer_Ctx)); 1254 Lexer_Ctx *ctx = malloc(sizeof(Lexer_Ctx));
1255 if (!ctx)
1256 {
1257 fprintf(stderr, "eolian: out of memory pushing context\n");
1258 longjmp(ls->err_jmp, EINA_TRUE);
1259 }
1255 ctx->line = ls->line_number; 1260 ctx->line = ls->line_number;
1256 ctx->column = ls->column; 1261 ctx->column = ls->column;
1257 ctx->linestr = ls->stream_line; 1262 ctx->linestr = ls->stream_line;