You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2017/05/27 10:52:22 UTC

svn commit: r1796378 - /httpd/httpd/trunk/modules/http2/h2_mplx.c

Author: jailletc36
Date: Sat May 27 10:52:22 2017
New Revision: 1796378

URL: http://svn.apache.org/viewvc?rev=1796378&view=rev
Log:
Move a potential NULL pointer dereference.
Check if 'slave' is NULL before using 'slave->keepalives'.

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

Modified:
    httpd/httpd/trunk/modules/http2/h2_mplx.c

Modified: httpd/httpd/trunk/modules/http2/h2_mplx.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_mplx.c?rev=1796378&r1=1796377&r2=1796378&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_mplx.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_mplx.c Sat May 27 10:52:22 2017
@@ -292,12 +292,12 @@ static void task_destroy(h2_mplx *m, h2_
     
     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_
         else {
             h2_beam_log(task->output.beam, m->c, APLOG_TRACE1, 
                         "h2_task_destroy, destroy slave");    
-            slave->sbh = NULL;
             h2_slave_destroy(slave);
         }
     }