mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 05:41:26 +02:00
CLEANUP: Re-apply xalloc_size.cocci (3)
This reapplies the xalloc_size.cocci patch across the whole `src/` tree. see 16cc16dd8235e7eb6c38b7abd210bd1e1d96b1d9 see 63ee0e4c01b94aee5fc6c6dd98cfc4480ae5ea46 see 9fb57e8c175a0b852b06a0780f48eb8eaf321a47
This commit is contained in:
parent
ff3dcb20f2
commit
d7eaa0d553
@ -895,7 +895,8 @@ static int postcheck_log_backend(struct proxy *be)
|
|||||||
/* alloc srv array (it will be used for active and backup server lists in turn,
|
/* alloc srv array (it will be used for active and backup server lists in turn,
|
||||||
* so we ensure that the longest list will fit
|
* so we ensure that the longest list will fit
|
||||||
*/
|
*/
|
||||||
be->lbprm.log.srv = calloc(MAX(be->srv_act, be->srv_bck), sizeof(struct server *));
|
be->lbprm.log.srv = calloc(MAX(be->srv_act, be->srv_bck),
|
||||||
|
sizeof(*be->lbprm.log.srv));
|
||||||
|
|
||||||
if (!be->lbprm.log.srv ) {
|
if (!be->lbprm.log.srv ) {
|
||||||
memprintf(&msg, "memory error when allocating server array (%d entries)",
|
memprintf(&msg, "memory error when allocating server array (%d entries)",
|
||||||
|
@ -760,7 +760,7 @@ static int quic_alloc_dghdlrs(void)
|
|||||||
MT_LIST_INIT(&dghdlr->dgrams);
|
MT_LIST_INIT(&dghdlr->dgrams);
|
||||||
}
|
}
|
||||||
|
|
||||||
quic_cid_trees = calloc(QUIC_CID_TREES_CNT, sizeof(struct quic_cid_tree));
|
quic_cid_trees = calloc(QUIC_CID_TREES_CNT, sizeof(*quic_cid_trees));
|
||||||
if (!quic_cid_trees) {
|
if (!quic_cid_trees) {
|
||||||
ha_alert("Failed to allocate global CIDs trees.\n");
|
ha_alert("Failed to allocate global CIDs trees.\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1363,7 +1363,7 @@ static int srv_parse_set_proxy_v2_tlv_fmt(char **args, int *cur_arg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
srv_tlv = malloc(sizeof(struct srv_pp_tlv_list));
|
srv_tlv = malloc(sizeof(*srv_tlv));
|
||||||
if (unlikely(!srv_tlv)) {
|
if (unlikely(!srv_tlv)) {
|
||||||
memprintf(err, "'%s' : failed to parse allocate TLV entry", args[*cur_arg]);
|
memprintf(err, "'%s' : failed to parse allocate TLV entry", args[*cur_arg]);
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -2516,7 +2516,7 @@ void srv_settings_cpy(struct server *srv, const struct server *src, int srv_tmpl
|
|||||||
list_for_each_entry(srv_tlv, &src->pp_tlvs, list) {
|
list_for_each_entry(srv_tlv, &src->pp_tlvs, list) {
|
||||||
if (srv_tlv == NULL)
|
if (srv_tlv == NULL)
|
||||||
break;
|
break;
|
||||||
new_srv_tlv = malloc(sizeof(struct srv_pp_tlv_list));
|
new_srv_tlv = malloc(sizeof(*new_srv_tlv));
|
||||||
if (unlikely(!new_srv_tlv)) {
|
if (unlikely(!new_srv_tlv)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4270,7 +4270,7 @@ int proxy_parse_smtpchk_opt(char **args, int cur_arg, struct proxy *curpx, const
|
|||||||
(strcmp(args[cur_arg], "EHLO") == 0 || strcmp(args[cur_arg], "HELO") == 0)) {
|
(strcmp(args[cur_arg], "EHLO") == 0 || strcmp(args[cur_arg], "HELO") == 0)) {
|
||||||
/* <EHLO|HELO> + space (1) + <host> + null byte (1) */
|
/* <EHLO|HELO> + space (1) + <host> + null byte (1) */
|
||||||
size_t len = strlen(args[cur_arg]) + 1 + strlen(args[cur_arg+1]) + 1;
|
size_t len = strlen(args[cur_arg]) + 1 + strlen(args[cur_arg+1]) + 1;
|
||||||
cmd = calloc(len, 1);
|
cmd = calloc(1, len);
|
||||||
if (cmd)
|
if (cmd)
|
||||||
snprintf(cmd, len, "%s %s", args[cur_arg], args[cur_arg+1]);
|
snprintf(cmd, len, "%s %s", args[cur_arg], args[cur_arg+1]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user