]> granicus.if.org Git - apache/commitdiff
Fix crash in mod_log_config when logging
authorRainer Jung <rjung@apache.org>
Sun, 14 Apr 2013 11:16:40 +0000 (11:16 +0000)
committerRainer Jung <rjung@apache.org>
Sun, 14 Apr 2013 11:16:40 +0000 (11:16 +0000)
request end time for a failed request
(LogFormat contains %{end}t).

The request_config for mod_log_config might
not be initialized.

PR 54828.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1467765 13f79535-47bb-0310-9956-ffa450edef68

modules/loggers/mod_log_config.c

index 11a769c746f7680ad300eb8ea4480d87a8d9baed..5e666ed4089ff5e3ad4eb7a39b9092cff4fb75a9 100644 (file)
@@ -597,6 +597,10 @@ static apr_time_t get_request_end_time(request_rec *r)
 {
     log_request_state *state = (log_request_state *)ap_get_module_config(r->request_config,
                                                                          &log_config_module);
+    if (!state) {
+        state = apr_pcalloc(r->pool, sizeof(log_request_state));
+        ap_set_module_config(r->request_config, &log_config_module, state);
+    }
     if (state->request_end_time == 0) {
         state->request_end_time = apr_time_now();
     }