Browse Source

Simply throw memory error.

pull/50/head
Rafal Kupiec 2 years ago
parent
commit
661158d249
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
1 changed files with 4 additions and 7 deletions
  1. +4
    -7
      engine/vm.c

+ 4
- 7
engine/vm.c View File

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


Loading…
Cancel
Save