cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Memory leaks using callbacks

From: James Dennett <jdennett_at_technocom-wireless.com>
Date: Tue, 13 Nov 2007 09:39:46 -0800

Daniel Stenberg wrote:

> On Tue, 13 Nov 2007, Raquel Vieira wrote:
>
> Please don't top-post:
http://curl.haxx.se/mail/etiquette.html#top-post
>
> > The variable 'data' is the data that I'm returning from the
callback.
> > I'm deleting that variable in the method httpPost that calls the
> > callback.
>
> Nope. The data is a pointer that is passed to your callback, modifying
> that
> won't help. You need to make the pointer point to something in which
you
> can
> return data.

No; it's a reference to a pointer already (this is C++), and so it does
modify the caller's pointer. The problem lies elsewhere (though using
new[] in this manner from C++ code is cause for concern, at least).

-- James
Received on 2007-11-13