cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Mon, 11 Oct 2010 21:13:56 +0200

On Monday 11 October 2010 20:09:46 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

What changes the address?

What exactly is _request?

> no longer safely free it. I get a HeapValidate exception because
> libcurl changes the address to somewhere in not-my-memory-space.

That's not likely to happen. You're example is incomplete. Please provide
a minimal example we can compile, run and play with.

> What is the correct way to free _request.memory? Is it already free'd
> by curl and I don't need to worry about it? I'd rather not call

libcurl does not free any data of your application, you need to free it
yourself.

> curl_global_cleanup after every single request.

You should call curl_global_init() and curl_global_cleanup() only once.

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