From 46e509c0a9bdb57e0dacd55c05bd9f9ad7106ccb Mon Sep 17 00:00:00 2001 From: Simon Best Date: Fri, 12 Apr 2013 16:49:07 +0100 Subject: [PATCH] Use the PHP memory management functions emalloc and efree. --- v8js.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v8js.cc b/v8js.cc index 9a28652..811d571 100644 --- a/v8js.cc +++ b/v8js.cc @@ -694,7 +694,7 @@ static void php_v8js_timer_push(long time_limit, long memory_limit, php_v8js_ctx V8JSG(timer_mutex).lock(); // Create context for this timer - php_v8js_timer_ctx *timer_ctx = (php_v8js_timer_ctx *)malloc(sizeof(php_v8js_timer_ctx)); + php_v8js_timer_ctx *timer_ctx = (php_v8js_timer_ctx *)emalloc(sizeof(php_v8js_timer_ctx)); // Calculate the time point when the time limit is exceeded std::chrono::milliseconds duration(time_limit); @@ -717,7 +717,7 @@ static void php_v8js_timer_pop() if (V8JSG(timer_stack).size()) { // Free the timer context memory php_v8js_timer_ctx *timer_ctx = V8JSG(timer_stack).top(); - free(timer_ctx); + efree(timer_ctx); // Remove the timer context from the stack V8JSG(timer_stack).pop();