]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: l7-retries: do not test the buffer before calling b_alloc()
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 11 Jun 2021 13:55:56 +0000 (15:55 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 11 Jun 2021 14:04:28 +0000 (16:04 +0200)
The return value is enough now to know if the allocation succeeded or
failed.

This cleanup was already pushed by Willy (f499f50) but a revert crushed
it. It may be backported to the 2.4 because the original patch was done on
this version.

src/stream_interface.c

index cd01840e25731fca6bef71c1c945729298a67dc4..44001230cf1ea4e4f4b99cabb6bc1f081eed2acc 100644 (file)
@@ -740,9 +740,7 @@ int si_cs_send(struct conn_stream *cs)
                        if (!s->txn || (s->txn->req.msg_state != HTTP_MSG_DONE))
                                si->flags &= ~SI_FL_L7_RETRY;
                        else {
-                               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),