From 52d98194b539605a4bd5bfeddc367bff283ac28f Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Thu, 14 Feb 2019 11:53:02 +0100
Subject: [PATCH 541/557] examples/postinmemory: Potential leak of memory
 pointed to by 'chunk.memory'

Detected by scan-build
---
 docs/examples/postinmemory.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/docs/examples/postinmemory.c b/docs/examples/postinmemory.c
index 25a1e8e..376f334 100644
--- a/docs/examples/postinmemory.c
+++ b/docs/examples/postinmemory.c
@@ -106,10 +105,9 @@ int main(void)
     /* always cleanup */
     curl_easy_cleanup(curl);
 
-    free(chunk.memory);
-
     /* we're done with libcurl, so clean it up */
     curl_global_cleanup();
   }
+  free(chunk.memory);
   return 0;
 }
-- 
1.8.3.1

