mirror of
https://github.com/curl/curl.git
synced 2026-04-13 12:41:42 +08:00
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/tool_operate.c: In function ‘add_per_transfer’:
src/tool_operate.c:213:5: warning: allocation of insufficient size ‘1’ for type ‘struct per_transfer’ with size ‘480’ [-Walloc-size]
213 | p = calloc(sizeof(struct per_transfer), 1);
| ^
src/var.c: In function ‘addvariable’:
src/var.c:361:5: warning: allocation of insufficient size ‘1’ for type ‘struct var’ with size ‘32’ [-Walloc-size]
361 | p = calloc(sizeof(struct var), 1);
| ^
```
The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```
So, just swap the number of members and size arguments to match the
prototype, as we're initialising 1 struct of size `sizeof(struct
...)`. GCC then sees we're not doing anything wrong.
Closes #12292
|
||
|---|---|---|
| .. | ||
| .gitignore | ||
| base64.pl | ||
| CMakeLists.txt | ||
| disabled.c | ||
| fake_ntlm.c | ||
| getpart.c | ||
| getpart.h | ||
| Makefile.am | ||
| Makefile.inc | ||
| mqttd.c | ||
| resolve.c | ||
| rtspd.c | ||
| server_setup.h | ||
| server_sockaddr.h | ||
| sockfilt.c | ||
| socksd.c | ||
| sws.c | ||
| testpart.c | ||
| tftp.h | ||
| tftpd.c | ||
| util.c | ||
| util.h | ||