examples: fix more potential resource leaks, and more

Also:
- delete dead code.
- sync `http2-download.c` and `http2-upload.c` sources.
- simplessl: fix constant expression.
- simplessl: avoid `expression is constant` VS2010 warning, drop pragma.
- replace large stack buffers with dynamic allocation.
- http2-download: fix to fill transfer number.

Some of these were pointed out by TIOBE scanner via Coverity 2025.3.0.

Closes #19292
This commit is contained in:
Viktor Szakats 2025-10-31 04:22:42 +01:00
parent 4b85e489a4
commit 869143b194
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
11 changed files with 276 additions and 272 deletions

View file

@ -225,14 +225,15 @@ int main(int argc, char *argv[])
/* init a multi stack */
multi_handle = curl_multi_init();
if(!multi_handle)
goto error;
easy = curl_easy_init();
/* set options */
if(setup(easy, url)) {
if(!easy || setup(easy, url)) {
fprintf(stderr, "failed\n");
curl_global_cleanup();
return 1;
goto error;
}
curl_multi_setopt(multi_handle, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
@ -272,7 +273,11 @@ int main(int argc, char *argv[])
} while(transfers); /* as long as we have transfers going */
curl_multi_cleanup(multi_handle);
error:
if(multi_handle)
curl_multi_cleanup(multi_handle);
curl_global_cleanup();
fclose(out_download);