From: Uwe Schindler Date: Fri, 20 Mar 2009 15:54:36 +0000 (+0000) Subject: Fix a sigsegv on server shutdown, add missing sapi_shutdown(). X-Git-Tag: php-5.2.10RC1~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b43578d548b68f19cc8f2b7a9b8aa5321174eb6;p=php Fix a sigsegv on server shutdown, add missing sapi_shutdown(). --- diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index 62564e7fbd..d5e070685d 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -455,6 +455,11 @@ static void sapi_nsapi_flush(void *server_context) { nsapi_request_context *rc = (nsapi_request_context *)server_context; TSRMLS_FETCH(); + + if (!rc) { + /* we have no context, so no flushing needed. This fixes a SIGSEGV on shutdown */ + return; + } if (!SG(headers_sent)) { sapi_send_headers(TSRMLS_C); @@ -826,6 +831,7 @@ void NSAPI_PUBLIC php5_close(void *vparam) } #endif + sapi_shutdown(); tsrm_shutdown(); log_error(LOG_INFORM, "php5_close", NULL, NULL, "Shutdown PHP Module");