cURL / Mailing Lists / curl-library / Single Mail


RE: Memory leaks using callbacks

From: James Dennett <>
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:
> > The variable 'data' is the data that I'm returning from the
> > 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
> 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