Simply throw memory error.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-04-15 17:41:29 +02:00
parent 94e06f3d3a
commit 661158d249
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 4 additions and 7 deletions

View File

@ -1353,26 +1353,23 @@ static ph7_value *VmCreateMemObj(
ph7_value *pObj; ph7_value *pObj;
VmSlot sLocal; VmSlot sLocal;
char *zName = (char *)pName->zString; char *zName = (char *)pName->zString;
/* Reserve a memory object */
pObj = PH7_ReserveMemObj(&(*pVm)); pObj = PH7_ReserveMemObj(&(*pVm));
if(pObj == 0) { if(pObj == 0) {
return 0; PH7_VmMemoryError(&(*pVm));
} }
nIdx = pObj->nIdx; nIdx = pObj->nIdx;
if(bDup) { if(bDup) {
/* Duplicate name */ /* Duplicate name */
zName = SyMemBackendStrDup(&pVm->sAllocator, pName->zString, pName->nByte); zName = SyMemBackendStrDup(&pVm->sAllocator, pName->zString, pName->nByte);
if(zName == 0) { if(zName == 0) {
return 0; PH7_VmMemoryError(&(*pVm));
} }
} }
/* Link to the top active VM frame */ /* Link to the top active VM frame */
rc = SyHashInsert(&pVm->pFrame->hVar, zName, pName->nByte, SX_INT_TO_PTR(nIdx)); rc = SyHashInsert(&pVm->pFrame->hVar, zName, pName->nByte, SX_INT_TO_PTR(nIdx));
if(rc != SXRET_OK) { if(rc != SXRET_OK) {
/* Return the slot to the free pool */ PH7_VmMemoryError(&(*pVm));
sLocal.nIdx = nIdx;
sLocal.pUserData = 0;
SySetPut(&pVm->aFreeObj, (const void *)&sLocal);
return 0;
} }
/* Register local variable */ /* Register local variable */
sLocal.nIdx = nIdx; sLocal.nIdx = nIdx;