]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ngtcp2: fix compiler warning about possible null-deref
authorStefan Eissing <stefan@eissing.org>
Fri, 19 May 2023 07:33:59 +0000 (09:33 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 19 May 2023 14:19:56 +0000 (16:19 +0200)
- compiler analyzer did not include the call context for this
  static function where the condition had already been checked.
- eleminating the problem by making stream a call parameter

Fixes #11147
Closes #11151

lib/vquic/curl_ngtcp2.c

index 7794f148c6ec925fdee066c44881111e158c63d8..3feace04a75939220ecffa022f4f4ba4bf505a90 100644 (file)
@@ -1312,13 +1312,12 @@ fail:
 
 static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
                                   struct Curl_easy *data,
+                                  struct stream_ctx *stream,
                                   CURLcode *err)
 {
-  struct stream_ctx *stream = H3_STREAM_CTX(data);
   ssize_t nread = -1;
 
   (void)cf;
-  DEBUGASSERT(stream);
   if(stream->reset) {
     failf(data,
           "HTTP/3 stream %" PRId64 " reset by server", stream->id);
@@ -1413,7 +1412,7 @@ static ssize_t cf_ngtcp2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
   }
   else {
     if(stream->closed) {
-      nread = recv_closed_stream(cf, data, err);
+      nread = recv_closed_stream(cf, data, stream, err);
       goto out;
     }
     *err = CURLE_AGAIN;