]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
conncache: silence `-Wnull-dereference` on gcc 14 RISC-V 64
authorViktor Szakats <commit@vsz.me>
Wed, 5 Nov 2025 18:53:30 +0000 (19:53 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 6 Nov 2025 10:42:34 +0000 (11:42 +0100)
A false positive that appeared after a recent patch for no reason.

Seen in curl-for-win unity native Linux builds on debian:testing and
debian:trixie with gcc 14.3.0 and 14.2.0 respectively:
```
-- curl version=[8.17.1-DEV]
-- The C compiler identification is GNU 14.2.0
-- Cross-compiling: Linux/x86_64 -> Linux/riscv64
[...]
lib/conncache.c: In function 'Curl_cpool_conn_now_idle':
lib/conncache.c:539:11: error: null pointer dereference [-Werror=null-dereference]
  539 |   if(!data->multi->maxconnects) {
      |       ~~~~^~~~~~~
```
Ref: https://github.com/curl/curl-for-win/actions/runs/19111497271/job/54609512969#step:3:5788

```
-- The C compiler identification is GNU 14.3.0
```
Ref: https://github.com/curl/curl-for-win/actions/runs/19111497271/job/54609512899#step:3:5801

Patch confirmed silencing:
https://github.com/curl/curl-for-win/actions/runs/19112580362/job/54613288202

Follow-up to fbc4d59151dc4a56052f3a92da3682dc97b32148 #19271

Closes #19378

lib/conncache.c

index d5770ef9164c282f6b4c92b92f3025caf058d907..7dc21d967adc8443c4b27ca9970a3819e867dfbd 100644 (file)
@@ -536,6 +536,9 @@ bool Curl_cpool_conn_now_idle(struct Curl_easy *data,
   struct cpool *cpool = cpool_get_instance(data);
   bool kept = TRUE;
 
+  if(!data)
+    return kept;
+
   if(!data->multi->maxconnects) {
     unsigned int running = Curl_multi_xfers_running(data->multi);
     maxconnects = (running <= UINT_MAX / 4) ? running * 4 : UINT_MAX;