Browse Source

Use the PHP memory management functions emalloc and efree.

Simon Best 12 năm trước cách đây
mục cha
commit
46e509c0a9
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      v8js.cc

+ 2 - 2
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();