mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-14 08:49:21 +02:00
CLEANUP: Do not use a fixed type for 'sizeof' in 'calloc'
Changes performed using the following coccinelle patch:
@@
type T;
expression E;
expression t;
@@
(
t = calloc(E, sizeof(*t))
|
- t = calloc(E, sizeof(T))
+ t = calloc(E, sizeof(*t))
)
Looking through the commit history, grepping for coccinelle shows that the same
replacement with a different patch was already performed in the past in commit
02779b6263.
This commit is contained in:
committed by
Willy Tarreau
parent
b53dd03dc0
commit
e52b6e5456
@@ -799,7 +799,8 @@ void mworker_reload()
|
||||
old_argc++;
|
||||
|
||||
/* 1 for haproxy -sf, 2 for -x /socket */
|
||||
next_argv = calloc(old_argc + 1 + 2 + mworker_child_nb() + nb_oldpids + 1, sizeof(char *));
|
||||
next_argv = calloc(old_argc + 1 + 2 + mworker_child_nb() + nb_oldpids + 1,
|
||||
sizeof(*next_argv));
|
||||
if (next_argv == NULL)
|
||||
goto alloc_error;
|
||||
|
||||
@@ -1133,7 +1134,7 @@ static char **copy_argv(int argc, char **argv)
|
||||
{
|
||||
char **newargv, **retargv;
|
||||
|
||||
newargv = calloc(argc + 2, sizeof(char *));
|
||||
newargv = calloc(argc + 2, sizeof(*newargv));
|
||||
if (newargv == NULL) {
|
||||
ha_warning("Cannot allocate memory\n");
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user