Gracefully throw an error when parser runs out of memory.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2016-08-11 00:52:45 -07:00
parent 405bccf4d6
commit b6f174cce7
3 changed files with 50 additions and 2 deletions
+3 -2
View File
@@ -39,8 +39,9 @@ parser_malloc (parser_context_t *context_p, /**< context */
void *result;
JERRY_ASSERT (size > 0);
result = jmem_heap_alloc_block (size);
if (result == 0)
result = jmem_heap_alloc_block_null_on_error (size);
if (result == NULL)
{
parser_raise_error (context_p, PARSER_ERR_OUT_OF_MEMORY);
}