Unref hashmap and object only if there is any data stored.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2018-09-24 11:29:51 +02:00
parent ba0c250911
commit 59fda6d797
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 6 additions and 4 deletions

View File

@ -814,10 +814,12 @@ PH7_PRIVATE sxi32 PH7_MemObjLoad(ph7_value *pSrc, ph7_value *pDest) {
*/
PH7_PRIVATE sxi32 PH7_MemObjRelease(ph7_value *pObj) {
if((pObj->iFlags & MEMOBJ_NULL) == 0) {
if(pObj->iFlags & MEMOBJ_HASHMAP) {
PH7_HashmapUnref((ph7_hashmap *)pObj->x.pOther);
} else if(pObj->iFlags & MEMOBJ_OBJ) {
PH7_ClassInstanceUnref((ph7_class_instance *)pObj->x.pOther);
if(pObj->x.pOther) {
if(pObj->iFlags & MEMOBJ_HASHMAP) {
PH7_HashmapUnref((ph7_hashmap *)pObj->x.pOther);
} else if(pObj->iFlags & MEMOBJ_OBJ) {
PH7_ClassInstanceUnref((ph7_class_instance *)pObj->x.pOther);
}
}
/* Release the internal buffer */
SyBlobRelease(&pObj->sBlob);