]> granicus.if.org Git - apache/commitdiff
Fix r1533728. Not a great idea to dereference process after pool destroy!
authorNick Kew <niq@apache.org>
Mon, 21 Oct 2013 00:30:26 +0000 (00:30 +0000)
committerNick Kew <niq@apache.org>
Mon, 21 Oct 2013 00:30:26 +0000 (00:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1534015 13f79535-47bb-0310-9956-ffa450edef68

server/main.c

index ef17af67082a62420b7acccf08eca7e38ce71482..836316ffae820ff2593c29b30ddee0508aac6073 100644 (file)
@@ -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);