Re: [PATCH 4/4] CLEANUP: Re-apply xalloc_size.cocci

2021-11-07 Thread Willy Tarreau
On Sat, Nov 06, 2021 at 03:14:45PM +0100, Tim Duesterhus wrote:
> Use a consistent size as the parameter for the *alloc family.

Series applied, thanks Tim!
Willy



[PATCH 4/4] CLEANUP: Re-apply xalloc_size.cocci

2021-11-06 Thread Tim Duesterhus
Use a consistent size as the parameter for the *alloc family.
---
 src/ev_evports.c | 2 +-
 src/hlua.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ev_evports.c b/src/ev_evports.c
index 710d51236..73e97517c 100644
--- a/src/ev_evports.c
+++ b/src/ev_evports.c
@@ -293,7 +293,7 @@ static int init_evports_per_thread()
int fd;
 
evports_evlist_max = global.tune.maxpollevents;
-   evports_evlist = calloc(evports_evlist_max, sizeof (port_event_t));
+   evports_evlist = calloc(evports_evlist_max, sizeof(*evports_evlist));
if (evports_evlist == NULL) {
goto fail_alloc;
}
diff --git a/src/hlua.c b/src/hlua.c
index 086a8e0be..c2e56b3b9 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -7089,7 +7089,7 @@ struct http_hdr *hlua_httpclient_table_to_hdrs(lua_State 
*L)
 
if (hdr_num) {
/* alloc and copy the headers in the httpclient struct */
-   result = calloc((hdr_num + 1), sizeof(*hdrs));
+   result = calloc((hdr_num + 1), sizeof(*result));
if (!result)
goto skip_headers;
memcpy(result, hdrs, sizeof(struct http_hdr) * (hdr_num + 1));
-- 
2.33.1