cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: How do I free the memory used by an in-memory, non-formdata post request? (HeapValidate exception)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 11 Oct 2010 21:15:53 +0200 (CEST)

On Mon, 11 Oct 2010, Ola Mork wrote:

> Everything functions as expected. My problem is that after I've called
> curl_easy_perform the address of my _request.memory changes and I can no
> longer safely free it. I get a HeapValidate exception because libcurl
> changes the address to somewhere in not-my-memory-space.

No, libcurl doesn't touch your struct. libcurl passes on the pointer that you
tell it to pass on, everything else is your app doing what it wants to do.

> What is the correct way to free _request.memory?

That's your application's work.

> Is it already free'd by curl and I don't need to worry about it?

curl cannot free it, it doesn't even know what you allocated anything and it
doesn't even know about _request.memory's existance.

> I'd rather not call curl_global_cleanup after every single request.

That wouldn't even solve anything.

> I discovered this using libcurl 7.16.4 but it's apparent in 7.21.1 too.

This is not a flaw in libcurl...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-10-11

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET