mirror of
https://github.com/curl/curl.git
synced 2026-08-26 19:53:31 +03:00
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:
parent
4b85e489a4
commit
869143b194
11 changed files with 276 additions and 272 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue