From 407bcf5a29a8f200ed2e76f191e6df97f1abdb26 Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 17 Apr 2019 17:29:05 +0200 Subject: [PATCH] Fix segmentation fault on Program::__construct() call. --- engine/vm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/vm.c b/engine/vm.c index df64b24..5ad25ab 100644 --- a/engine/vm.c +++ b/engine/vm.c @@ -5274,14 +5274,14 @@ PH7_PRIVATE sxi32 PH7_VmByteCodeExec(ph7_vm *pVm) { if(pInstance == 0) { PH7_VmMemoryError(&(*pVm)); } - /* Enable garbage collector */ - pInstance->iRef--; /* Check if a constructor is available */ pMethod = PH7_ClassExtractMethod(pClass, "__construct", sizeof("__construct") - 1); if(pMethod) { /* Call the class constructor */ PH7_VmCallClassMethod(&(*pVm), pInstance, pMethod, 0, 0, 0); } + /* Enable garbage collector */ + pInstance->iRef--; pArgs = ph7_new_array(&(*pVm)); sArgv = ph7_new_scalar(&(*pVm)); if(!pArgs || !sArgv) {