aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2019-12-24 01:06:47 -0500
committerJay Satiro <raysatiro@yahoo.com>2019-12-24 01:06:47 -0500
commit68da0b8b8694328b214e687a6cff5cbb744dcfd5 (patch)
tree8b51b5cc38a635301f46a78826888f8b121d9d2d
parent4c2f5d52ba62f1c24a99c6338b8138495f9281de (diff)
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
-rw-r--r--docs/examples/postinmemory.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/docs/examples/postinmemory.c b/docs/examples/postinmemory.c
index 376f33450..e2718c5ba 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;
}