Skip to content

Commit f095d2c

Browse files
committed
Fix freeing of internal attribute arguments
1 parent 8b15858 commit f095d2c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2022, PHP 8.0.18
44

5+
- Core:
6+
. Fixed freeing of internal attribute arguments. (Bob)
7+
58
- Intl:
69
. Fixed bug GH-8142 (Compilation error on cygwin). (David Carlier)
710

Zend/zend_attributes.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ ZEND_API zend_bool zend_is_attribute_repeated(HashTable *attributes, zend_attrib
181181
static void attr_free(zval *v)
182182
{
183183
zend_attribute *attr = Z_PTR_P(v);
184+
bool persistent = attr->flags & ZEND_ATTRIBUTE_PERSISTENT;
184185

185186
zend_string_release(attr->name);
186187
zend_string_release(attr->lcname);
@@ -189,10 +190,14 @@ static void attr_free(zval *v)
189190
if (attr->args[i].name) {
190191
zend_string_release(attr->args[i].name);
191192
}
192-
zval_ptr_dtor(&attr->args[i].value);
193+
if (persistent) {
194+
zval_internal_ptr_dtor(&attr->args[i].value);
195+
} else {
196+
zval_ptr_dtor(&attr->args[i].value);
197+
}
193198
}
194199

195-
pefree(attr, attr->flags & ZEND_ATTRIBUTE_PERSISTENT);
200+
pefree(attr, persistent);
196201
}
197202

198203
ZEND_API zend_attribute *zend_add_attribute(HashTable **attributes, zend_string *name, uint32_t argc, uint32_t flags, uint32_t offset, uint32_t lineno)

0 commit comments

Comments
 (0)