cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Memory leak in curl

From: Gisle Vanem <giva_at_bgnett.no>
Date: Fri, 20 Aug 2004 13:15:35 +0200

"Rupesh" <rdeole_at_yahoo.com> said:

> This is the code for call back function which I have
> written.
>
> size_t ReadReply(void *buffer, size_t size, size_t
> nmemb, void *userp)
> {
> m_strReply = new char[size*nmemb +1 ];
> memset(m_strReply,0,size*nmemb);
> memcpy(m_strReply,buffer,size*nmemb);
> return size*nmemb;
> }
> How can I delete memory allocated for first parameter
> in this function or curl do it for me?
>
> I tried free_curl(buffer) it is giving me core dump.

Memory allocated with 'new' must be freed with 'delete'.

--gv
Received on 2004-08-20