]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: tcpcheck: use pool_zalloc() instead of pool_alloc+memset
authorWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 20:11:45 +0000 (21:11 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 22 Mar 2021 22:20:03 +0000 (23:20 +0100)
Two places used to alloc then zero the area, let's have the allocator do it.

src/tcpcheck.c

index 90f1ee953ad7ffc03e44831c838cce26c02cfad5..52b47eed478b689b779224b58e162682c0e5d98a 100644 (file)
@@ -3618,9 +3618,8 @@ int add_tcpcheck_expect_str(struct tcpcheck_rules *rules, const char *str)
        struct tcpcheck_rule *tcpcheck, *prev_check;
        struct tcpcheck_expect *expect;
 
-       if ((tcpcheck = pool_alloc(pool_head_tcpcheck_rule)) == NULL)
+       if ((tcpcheck = pool_zalloc(pool_head_tcpcheck_rule)) == NULL)
                return 0;
-       memset(tcpcheck, 0, sizeof(*tcpcheck));
        tcpcheck->action = TCPCHK_ACT_EXPECT;
 
        expect = &tcpcheck->expect;
@@ -3661,9 +3660,8 @@ int add_tcpcheck_send_strs(struct tcpcheck_rules *rules, const char * const *str
        char *dst;
        int i;
 
-       if ((tcpcheck = pool_alloc(pool_head_tcpcheck_rule)) == NULL)
+       if ((tcpcheck = pool_zalloc(pool_head_tcpcheck_rule)) == NULL)
                return 0;
-       memset(tcpcheck, 0, sizeof(*tcpcheck));
        tcpcheck->action       = TCPCHK_ACT_SEND;
 
        send = &tcpcheck->send;