1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 09:08:49 -05:00

examples/postinmemory: Potential leak of memory pointed to by 'chunk.memory'

Detected by scan-build
This commit is contained in:
Daniel Stenberg 2019-02-14 11:53:02 +01:00
parent 9bd704c02a
commit 52d98194b5
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -67,7 +67,6 @@ int main(void)
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init(); curl = curl_easy_init();
if(curl) { if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.org/"); curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.org/");
/* send all data to this function */ /* send all data to this function */
@ -106,10 +105,9 @@ int main(void)
/* always cleanup */ /* always cleanup */
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
free(chunk.memory);
/* we're done with libcurl, so clean it up */ /* we're done with libcurl, so clean it up */
curl_global_cleanup(); curl_global_cleanup();
} }
free(chunk.memory);
return 0; return 0;
} }