]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: frontend: use pool_zalloc() in frontend_accept()
authorWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 20:06:21 +0000 (21:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 22:18:54 +0000 (23:18 +0100)
The capture buffers were allocated then zeroed, let's have the allocator
do it.

src/frontend.c

index 52527118b236933c923fe82b53be69cb573cb309..1be5a0fb071bf90fd5b84b27b24e47eab6ac4b52 100644 (file)
@@ -136,15 +136,13 @@ int frontend_accept(struct stream *s)
                s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */
 
        if (unlikely(fe->nb_req_cap > 0)) {
-               if ((s->req_cap = pool_alloc(fe->req_cap_pool)) == NULL)
+               if ((s->req_cap = pool_zalloc(fe->req_cap_pool)) == NULL)
                        goto out_return;        /* no memory */
-               memset(s->req_cap, 0, fe->nb_req_cap * sizeof(void *));
        }
 
        if (unlikely(fe->nb_rsp_cap > 0)) {
-               if ((s->res_cap = pool_alloc(fe->rsp_cap_pool)) == NULL)
+               if ((s->res_cap = pool_zalloc(fe->rsp_cap_pool)) == NULL)
                        goto out_free_reqcap;   /* no memory */
-               memset(s->res_cap, 0, fe->nb_rsp_cap * sizeof(void *));
        }
 
        if (fe->http_needed) {