Re: [PATCH] http-push: refactor request url creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Jan 26, 2009 at 4:35 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> @@ -304,17 +312,7 @@ static void start_fetch_loose(struct
>> transfer_request *request)
>>
>>       git_SHA1_Init(&request->c);
>>
>> -     url = xmalloc(strlen(remote->url) + 50);
>> ...
>> -     strcpy(request->url, url);
>> +     request->url = get_remote_object_url(remote->url, hex, 0);
>> ...
>> -     curl_easy_setopt(slot->curl, CURLOPT_URL, url);
>> +     curl_easy_setopt(slot->curl, CURLOPT_URL, request->url);
>
> The original code gave a separate "url" to setop() but this gives the same
> string.  Does curl_easy_setop() copies the given string away?  IOW is this
> change safe?
>

curl strdup's it, so this is safe.

The stack is like this:

curl_easy_setopt
calls Curl_setopt (at 391)
calls setstropt (at 1566)
calls strdup (at 276).

http://cool.haxx.se/cvs.cgi/curl/lib/easy.c?annotate=1.132 (for
curl_easy_setopt)
http://cool.haxx.se/cvs.cgi/curl/lib/url.c?annotate=1.782 (for
Curl_setopt, setstropt)

-- 
Cheers,
Ray Chuan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux