From 5485c45b815efa8634d336cff85f0f1c6c2ce720 Mon Sep 17 00:00:00 2001 From: Nick Kew Date: Mon, 21 Oct 2013 00:30:26 +0000 Subject: [PATCH] Fix r1533728. Not a great idea to dereference process after pool destroy! git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1534015 13f79535-47bb-0310-9956-ffa450edef68 --- server/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/main.c b/server/main.c index ef17af6708..836316ffae 100644 --- a/server/main.c +++ b/server/main.c @@ -264,12 +264,17 @@ static void destroy_and_exit_process(process_rec *process, * by us before they can do so. In this case maybe valueable log messages * might get lost. */ + + /* If we are to print an error, we need the name before we destroy pool. + * short_name is a pointer into argv, so remains valid. + */ + const char *name = process->short_name ? process->short_name : "httpd"; + apr_sleep(TASK_SWITCH_SLEEP); ap_main_state = AP_SQ_MS_EXITING; apr_pool_destroy(process->pool); /* and destroy all descendent pools */ apr_terminate(); if ((process_exit_value != 0) && isatty(fileno(stderr))) { - const char *name = process->short_name ? process->short_name : "httpd"; fprintf(stderr, "%s: abnormal exit %d\n", name, process_exit_value); } exit(process_exit_value); -- 2.40.0