From 8de27fd2ce8afae2544e38d248829c3cbf1cf916 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Fri, 1 Jan 2016 00:01:49 +0100 Subject: [PATCH] free v8::Persistent on bailout --- v8js_class.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/v8js_class.cc b/v8js_class.cc index 036fe24..1548d4b 100644 --- a/v8js_class.cc +++ b/v8js_class.cc @@ -554,8 +554,17 @@ static PHP_METHOD(V8Js, executeString) if (!res) { RETURN_FALSE; } - v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value TSRMLS_CC); - v8js_script_free(res); + + zend_try { + v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value TSRMLS_CC); + v8js_script_free(res); + } + zend_catch { + v8js_script_free(res); + zend_bailout(); + } + zend_end_try() + efree(res); } /* }}} */