]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
examples/postinmemory.c: Call curl_global_cleanup always
authorJay Satiro <raysatiro@yahoo.com>
Tue, 24 Dec 2019 06:06:47 +0000 (01:06 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 24 Dec 2019 06:06:47 +0000 (01:06 -0500)
Prior to this change curl_global_cleanup was not called if
curl_easy_init failed.

Reported-by: kouzhudong@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/4751

docs/examples/postinmemory.c

index 376f33450bdc9051c49b7ac770d7a077c48e74dd..e2718c5ba42213c27d8d6d80171fbca53328665b 100644 (file)
@@ -104,10 +104,9 @@ int main(void)
 
     /* always cleanup */
     curl_easy_cleanup(curl);
-
-    /* we're done with libcurl, so clean it up */
-    curl_global_cleanup();
   }
+
   free(chunk.memory);
+  curl_global_cleanup();
   return 0;
 }