From: Jay Satiro Date: Tue, 24 Dec 2019 06:06:47 +0000 (-0500) Subject: examples/postinmemory.c: Call curl_global_cleanup always X-Git-Tag: curl-7_68_0~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=68da0b8b8694328b214e687a6cff5cbb744dcfd5;p=thirdparty%2Fcurl.git examples/postinmemory.c: Call curl_global_cleanup always 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 --- diff --git a/docs/examples/postinmemory.c b/docs/examples/postinmemory.c index 376f33450b..e2718c5ba4 100644 --- a/docs/examples/postinmemory.c +++ b/docs/examples/postinmemory.c @@ -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; }