]> granicus.if.org Git - apache/commitdiff
Free the temporary working brigade upon exit from ap_get_client_block()
authorBrian Pane <brianp@apache.org>
Thu, 5 Sep 2002 06:20:02 +0000 (06:20 +0000)
committerBrian Pane <brianp@apache.org>
Thu, 5 Sep 2002 06:20:02 +0000 (06:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96639 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_protocol.c

index faf6463ba21b1f80bcd7def4ec2909590e91aee3..c30e56d00f45eb0b3cedef41490a09db37d63cc0 100644 (file)
@@ -1824,6 +1824,10 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer,
     apr_bucket_brigade *bb;
 
     bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
+    if (bb == NULL) {
+        r->connection->keepalive = AP_CONN_CLOSE;
+        return -1;
+    }
 
     rv = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
                         APR_BLOCK_READ, bufsiz);
@@ -1836,6 +1840,7 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer,
          * stop trying to read data from the client.
          */
         r->connection->keepalive = AP_CONN_CLOSE;
+        apr_brigade_destroy(bb);
         return -1;
     }
 
@@ -1847,12 +1852,14 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer,
  
     rv = apr_brigade_flatten(bb, buffer, &bufsiz);
     if (rv != APR_SUCCESS) {
+        apr_brigade_destroy(bb);
         return -1;
     }
 
     /* XXX yank me? */
     r->read_length += bufsiz;
 
+    apr_brigade_destroy(bb);
     return bufsiz;
 }