Skip to content

Commit 3c4c200

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix TSRM ignoring done
2 parents ede1568 + f9bf5f4 commit 3c4c200

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

TSRM/TSRM.c

+17-10
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,16 @@ TSRM_API void tsrm_shutdown(void)
188188
next_p = p->next;
189189
for (j=0; j<p->count; j++) {
190190
if (p->storage[j]) {
191-
if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
192-
resource_types_table[j].dtor(p->storage[j]);
193-
}
194-
if (!resource_types_table[j].fast_offset) {
195-
free(p->storage[j]);
191+
if (resource_types_table) {
192+
if (!resource_types_table[j].done) {
193+
if (resource_types_table[j].dtor) {
194+
resource_types_table[j].dtor(p->storage[j]);
195+
}
196+
197+
if (!resource_types_table[j].fast_offset) {
198+
free(p->storage[j]);
199+
}
200+
}
196201
}
197202
}
198203
}
@@ -531,11 +536,13 @@ void ts_free_id(ts_rsrc_id id)
531536

532537
while (p) {
533538
if (p->count > j && p->storage[j]) {
534-
if (resource_types_table && resource_types_table[j].dtor) {
535-
resource_types_table[j].dtor(p->storage[j]);
536-
}
537-
if (!resource_types_table[j].fast_offset) {
538-
free(p->storage[j]);
539+
if (resource_types_table) {
540+
if (resource_types_table[j].dtor) {
541+
resource_types_table[j].dtor(p->storage[j]);
542+
}
543+
if (!resource_types_table[j].fast_offset) {
544+
free(p->storage[j]);
545+
}
539546
}
540547
p->storage[j] = NULL;
541548
}

0 commit comments

Comments
 (0)