Skip to content

Commit 527a671

Browse files
committed
fix double-free in zai_hook_gshutdown
Doesn't fix the fact this is called repeatedly in the main thread. When called by `ts_free_id` the threads whose data we want to free are gone. For this to work propoerly we would need to register an actual thread data destructor.
1 parent 1cc4356 commit 527a671

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • zend_abstract_interface/hook

zend_abstract_interface/hook/hook.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,10 @@ void zai_hook_rshutdown(void) {
12661266
}
12671267
}
12681268

1269-
void zai_hook_gshutdown(void) { free(zai_hook_tls); }
1269+
void zai_hook_gshutdown(void) {
1270+
free(zai_hook_tls);
1271+
zai_hook_tls = NULL;
1272+
}
12701273

12711274
void zai_hook_mshutdown(void) {
12721275
zend_hash_destroy(&zai_hook_static);

0 commit comments

Comments
 (0)