]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
vquic: fix 4th function call argument is an uninitialized value
authorDaniel Stenberg <daniel@haxx.se>
Sun, 22 Dec 2024 23:11:31 +0000 (00:11 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 23 Dec 2024 07:28:27 +0000 (08:28 +0100)
As recvmmsg_packets() could fail early and goto out before 'pkts' were
assigned.

Caught by clang-tidy

Closes #15808

lib/vquic/vquic.c

index 20ff6a640b7ec46b7482e7c5b2c50060e74831f8..41a2cc9757210142bdf2d1669183c70e172af85e 100644 (file)
@@ -363,7 +363,7 @@ static CURLcode recvmmsg_packets(struct Curl_cfilter *cf,
   struct mmsghdr mmsg[MMSG_NUM];
   uint8_t msg_ctrl[MMSG_NUM * CMSG_SPACE(sizeof(int))];
   struct sockaddr_storage remote_addr[MMSG_NUM];
-  size_t total_nread = 0, pkts;
+  size_t total_nread = 0, pkts = 0;
   int mcount, i, n;
   char errstr[STRERROR_LEN];
   CURLcode result = CURLE_OK;
@@ -380,7 +380,6 @@ static CURLcode recvmmsg_packets(struct Curl_cfilter *cf,
     goto out;
   bufs = (uint8_t (*)[64*1024])sockbuf;
 
-  pkts = 0;
   total_nread = 0;
   while(pkts < max_pkts) {
     n = (int)CURLMIN(MMSG_NUM, max_pkts);