]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Apply xalloc_size.cocci
authorTim Duesterhus <tim@bastelstu.be>
Wed, 15 Sep 2021 11:58:46 +0000 (13:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 17 Sep 2021 15:22:05 +0000 (17:22 +0200)
This fixes a few locations with a hardcoded type within `sizeof()`.

include/haproxy/listener.h
src/errors.c

index 1c37d34daaf6b9f049390617395ef69e56c2379f..2212ca9271a79688b924eea10936ea2234db8e82 100644 (file)
@@ -179,7 +179,7 @@ unsigned int bind_map_thread_id(const struct bind_conf *conf, unsigned int r);
 static inline struct bind_conf *bind_conf_alloc(struct proxy *fe, const char *file,
                                  int line, const char *arg, struct xprt_ops *xprt)
 {
-       struct bind_conf *bind_conf = calloc(1, sizeof(struct bind_conf));
+       struct bind_conf *bind_conf = calloc(1, sizeof(*bind_conf));
 
        if (!bind_conf)
                goto err;
index d2eafcea484734b4ac5bbcfb4ec2c58dc2f175c7..993b6ae58284434e204ba3b06f7fd85bd752d672 100644 (file)
@@ -126,7 +126,7 @@ static void generate_usermsgs_ctx_str(void)
        int ret;
 
        if (unlikely(b_is_null(&ctx->str))) {
-               area = calloc(USERMSGS_CTX_BUFSIZE, sizeof(char));
+               area = calloc(USERMSGS_CTX_BUFSIZE, sizeof(*area));
                if (area)
                        ctx->str = b_make(area, USERMSGS_CTX_BUFSIZE, 0, 0);
        }