cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_duphandle issue

From: Frank Hempel <lists_at_frankoni.net>
Date: Mon, 09 Mar 2009 01:52:00 +0100

Daniel Stenberg schrieb:
>
> Nit: if one curl_slist_append() call fails due to out of mem, this will
> lead
> to leaked memory. A failure must cleanup the (incomplete) duplicated
> list before returning.

I thought the patch would do this already. Say one curl_slist_append()
call fails and results NULL. But the input list to curl_slist_append(),
which is outcurl->change.cookielist, remains as it is and is not
overwritten with NULL (cl_src), due to the break before. So it will be
freed with curl_slist_free_all() later (second part of the patch; maybe
you just overlooked that? Or maybe I'm just too blind to see...).

>
> Suggestion: how about making a separate "Curl_dup_cookielist" function
> and put
> it in the lib/cookie.c file where the other cookie functions live?
> To me
> it would feel better to keep them close to each other rather than
> to put
> the full logic within the curl_easy_duphandle() function.
>

Yes, sounds good. I will do that...

cu, Frank.
Received on 2009-03-09