Release VM and exit automatically, do not rely on VM.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-09-03 08:40:18 +02:00
parent eea9eee6e5
commit f176414bce
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 6 additions and 8 deletions

View File

@ -1894,11 +1894,9 @@ PH7_PRIVATE sxi32 PH7_VmMemoryError(
/* Consume the error message */ /* Consume the error message */
VmCallErrorHandler(&(*pVm), &sWorker); VmCallErrorHandler(&(*pVm), &sWorker);
} }
/* Set exit code to 255 */ /* Release the VM gracefully and abort script execution */
pVm->iExitStatus = 255; PH7_VmRelease(pVm);
/* There is no need to release VM. The script execution will automatically exit(255);
* get aborted and VM will be properly shut down when returned SXERR_ABORT */
return SXERR_ABORT;
} }
/* /*
* Throw a run-time error and invoke the supplied VM output consumer callback. * Throw a run-time error and invoke the supplied VM output consumer callback.
@ -1974,9 +1972,9 @@ PH7_PRIVATE sxi32 PH7_VmGenericError(
rc = VmCallErrorHandler(&(*pVm), &sWorker); rc = VmCallErrorHandler(&(*pVm), &sWorker);
} }
if(iErr == PH7_CTX_ERR) { if(iErr == PH7_CTX_ERR) {
/* Set exit code to 255 and abort script execution */ /* Release the VM gracefully and abort script execution */
pVm->iExitStatus = 255; PH7_VmRelease(pVm);
rc = SXERR_ABORT; exit(255);
} }
return rc; return rc;
} }