lib/cf-h1-proxy: silence compiler warnings (gcc 14)

They came up ealier with gcc 12 (Windows), but apparently gcc 14 is
still reporting them, also under Linux.

```
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c: In function 'cf_h1_proxy_close':
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:1060:17: warning: null pointer dereference [-Wnull-dereference]
 1060 |   cf->connected = FALSE;
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:1061:8: warning: null pointer dereference [-Wnull-dereference]
 1061 |   if(cf->ctx) {
      |      ~~^~~~~
In function 'tunnel_free',
    inlined from 'cf_h1_proxy_destroy' at /home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:1053:3:
/home/runner/work/curl-for-win/curl-for-win/curl/lib/cf-h1-proxy.c:198:27: warning: null pointer dereference [-Wnull-dereference]
  198 |   struct h1_tunnel_state *ts = cf->ctx;
      |                           ^~
```
Ref: https://github.com/curl/curl-for-win/actions/runs/8985369476/job/24679219528#step:3:6320

Fixes #13237
Closes #13555
This commit is contained in:
Viktor Szakats 2024-05-07 17:50:42 +02:00
parent 1ea7dce08d
commit bbeeccdea8
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201

View File

@ -195,6 +195,7 @@ static void h1_tunnel_go_state(struct Curl_cfilter *cf,
static void tunnel_free(struct Curl_cfilter *cf, static void tunnel_free(struct Curl_cfilter *cf,
struct Curl_easy *data) struct Curl_easy *data)
{ {
if(cf) {
struct h1_tunnel_state *ts = cf->ctx; struct h1_tunnel_state *ts = cf->ctx;
if(ts) { if(ts) {
h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data);
@ -205,6 +206,7 @@ static void tunnel_free(struct Curl_cfilter *cf,
cf->ctx = NULL; cf->ctx = NULL;
} }
} }
}
static bool tunnel_want_send(struct h1_tunnel_state *ts) static bool tunnel_want_send(struct h1_tunnel_state *ts)
{ {
@ -1057,6 +1059,7 @@ static void cf_h1_proxy_close(struct Curl_cfilter *cf,
struct Curl_easy *data) struct Curl_easy *data)
{ {
CURL_TRC_CF(data, cf, "close"); CURL_TRC_CF(data, cf, "close");
if(cf) {
cf->connected = FALSE; cf->connected = FALSE;
if(cf->ctx) { if(cf->ctx) {
h1_tunnel_go_state(cf, cf->ctx, H1_TUNNEL_INIT, data); h1_tunnel_go_state(cf, cf->ctx, H1_TUNNEL_INIT, data);
@ -1064,6 +1067,7 @@ static void cf_h1_proxy_close(struct Curl_cfilter *cf,
if(cf->next) if(cf->next)
cf->next->cft->do_close(cf->next, data); cf->next->cft->do_close(cf->next, data);
} }
}
struct Curl_cftype Curl_cft_h1_proxy = { struct Curl_cftype Curl_cft_h1_proxy = {