Skip to content

Commit

Permalink
try not to crash when closing persistent sockets, because EG(persiste…
Browse files Browse the repository at this point in the history
…nt_list)

is cleaned before the extensions' MSHUTDOWNs are called.
  • Loading branch information
faizshukri committed Oct 6, 2011
1 parent 3cddf1d commit c3019a1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ext/mysqlnd/mysqlnd_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,15 @@ mysqlnd_net_free(MYSQLND_NET * const net TSRMLS_DC)
if (net->stream) {
DBG_INF_FMT("Freeing stream. abstract=%p", net->stream->abstract);
if (pers) {
php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
if (EG(active)) {
php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE_PERSISTENT | PHP_STREAM_FREE_RSRC_DTOR);
} else {
/*
otherwise we will crash because the EG(persistent_list) has been freed already,
before the modules are shut down
*/
php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR);
}
} else {
php_stream_free(net->stream, PHP_STREAM_FREE_CLOSE);
}
Expand Down

0 comments on commit c3019a1

Please sign in to comment.