cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: write callback issues (was Re: A new problem)

From: Prasad J Pandit <prasad.pandit_at_comat.com>
Date: Fri, 4 Apr 2008 10:32:09 +0530 (IST)

On Thu, 3 Apr 2008, Linus Nielsen Feltzing wrote:
> This code looks very suspicious. Firstly, you overwrite the usrp pointer for
> every call, which will lead to a memory leak, since you don't delete the
> existing one first.
>
> Secondly, what purpose does the sprintf() fill? As you use it, it could be
> replaced with a simple memcpy(), since you seem to expect printable data
> anyway.
>
> Thirdly, with this approach, you will never see the entire result, since you
> are constantly overwriting the data from the previous callback.
>
> All in all, this code will not work very well.

   Oh..how very enlightening! But apparently the function is working well
for me.

Anyways...thanks for the information.

--
Regards
   - Prasad
Received on 2008-04-04