cURL / Mailing Lists / curl-library / Single Mail


Re: Error while closing connection after receiving POST response

From: Daniel Stenberg <>
Date: Thu, 21 Jun 2012 15:15:16 +0200 (CEST)

On Wed, 20 Jun 2012, Varun Gupta wrote:

> static size_t
> curlHttpClientWrite (void *buffer, size_t item_size, size_t num_items,
> void *responsePtr ) {
> printf("%s\n", (char*)buffer);

This is wrong. The buffer you get is not guaranteed to be zero terminated.

> I get the memory exception after I have received the response for the POST
> request. On enabling the VERBOSE flag, I saw that the last step mentioned in
> the debug logs was
> #Closing connection #0
> So, I am guessing that something went wrong while closing the connection or
> in some steps after that.
> Please let me know if you see something wrong with the code or what could be
> a good way to debug this problem.

Build with debug symbols present and get a backtrace from your debugger at the
place in the code where it gets the exception!

List admin:
Received on 2012-06-21