]> granicus.if.org Git - apache/commitdiff
Move a potential NULL pointer dereference.
authorChristophe Jaillet <jailletc36@apache.org>
Sat, 27 May 2017 10:52:22 +0000 (10:52 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Sat, 27 May 2017 10:52:22 +0000 (10:52 +0000)
Check if 'slave' is NULL before using 'slave->keepalives'.

Remove a redundant assignment which is already done in 'h2_slave_destroy'.

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

modules/http2/h2_mplx.c

index 0520dc59145670a5ac5b7a1e0d4370b16e5a8be2..ebe0156153a2370d3d090c318664759f4ac14e59 100644 (file)
@@ -292,12 +292,12 @@ static void task_destroy(h2_mplx *m, h2_task *task)
     
     slave = task->c;
 
-    if (m->s->keep_alive_max == 0 || slave->keepalives < m->s->keep_alive_max) {
-        reuse_slave = ((m->spare_slaves->nelts < (m->limit_active * 3 / 2))
-                       && !task->rst_error);
-    }
-    
     if (slave) {
+        if (m->s->keep_alive_max == 0 || slave->keepalives < m->s->keep_alive_max) {
+            reuse_slave = ((m->spare_slaves->nelts < (m->limit_active * 3 / 2))
+                           && !task->rst_error);
+        }
+
         if (reuse_slave && slave->keepalive == AP_CONN_KEEPALIVE) {
             h2_beam_log(task->output.beam, m->c, APLOG_DEBUG, 
                         APLOGNO(03385) "h2_task_destroy, reuse slave");    
@@ -307,7 +307,6 @@ static void task_destroy(h2_mplx *m, h2_task *task)
         else {
             h2_beam_log(task->output.beam, m->c, APLOG_TRACE1, 
                         "h2_task_destroy, destroy slave");    
-            slave->sbh = NULL;
             h2_slave_destroy(slave);
         }
     }