cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Error while closing connection after receiving POST response

From: Daniel Stenberg <daniel_at_haxx.se>
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!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-21