Skip to content

Commit c45f195

Browse files
committed
Remove delref in free_object_storage
This gives us better object leak diagnostics.
1 parent 2709d6a commit c45f195

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Zend/zend_objects_API.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_free_object_storage(zend_objects_
8787
return;
8888
}
8989

90-
/* Free object contents, but don't free objects themselves, so they show up as leaks */
90+
/* Free object contents, but don't free objects themselves, so they show up as leaks.
91+
* Also add a ref to all objects, so the object can't be freed by something else later. */
9192
end = objects->object_buckets + 1;
9293
obj_ptr = objects->object_buckets + objects->top;
9394

@@ -101,7 +102,6 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_free_object_storage(zend_objects_
101102
if (obj->handlers->free_obj != zend_object_std_dtor) {
102103
GC_ADDREF(obj);
103104
obj->handlers->free_obj(obj);
104-
GC_DELREF(obj);
105105
}
106106
}
107107
}
@@ -115,7 +115,6 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_free_object_storage(zend_objects_
115115
GC_ADD_FLAGS(obj, IS_OBJ_FREE_CALLED);
116116
GC_ADDREF(obj);
117117
obj->handlers->free_obj(obj);
118-
GC_DELREF(obj);
119118
}
120119
}
121120
} while (obj_ptr != end);

0 commit comments

Comments
 (0)