]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: l7-retries: do not test the buffer before calling b_alloc()
authorWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 15:17:37 +0000 (16:17 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 15:17:37 +0000 (16:17 +0100)
The return value is enough now to know if the allocation succeeded or
failed.

src/http_ana.c

index c53f0a617f9b7df78141f09b30a9faa039232ca5..82b389a5ddfb03f99d4433620ef7a187b95ec2b9 100644 (file)
@@ -1135,9 +1135,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
                         */
                        DBG_TRACE_STATE("enable L7 retry, save the request", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
                        si->flags |= SI_FL_L7_RETRY;
-                       if (b_is_null(&si->l7_buffer))
-                               b_alloc(&si->l7_buffer);
-                       if (b_is_null(&si->l7_buffer))
+                       if (b_alloc(&si->l7_buffer) == NULL)
                                si->flags &= ~SI_FL_L7_RETRY;
                        else {
                                memcpy(b_orig(&si->l7_buffer), b_orig(&req->buf), b_size(&req->buf));