Re: [RFH] lifetime rule for url parameter to transport_get()?

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

 



On Tue, 23 Aug 2011, Junio C Hamano wrote:

> Junio C Hamano <gitster@xxxxxxxxx> writes:
> 
> > Does anybody remember why we use a copied string of "ref_git_copy" in
> > builtin/clone.c::setup_reference()?
> >
> > 	ref_git = real_path(option_reference);
> > 	...
> > 	ref_git_copy = xstrdup(ref_git);
> 
> It didn't have anything to do with transport/remote layer.
> 
> This codepath uses real_path() and optionally mkpath(), both of which
> returns a short-lived static buffer to return its findings, and long-term
> users are expected to copy it away.

Yeah, that fits with my expectation, given the lack of a comment and the 
fact that you were asking about clone and not also fetch.

At least originally, the remote and transport data was expected to live 
until the process exits, since it's a small, bounded number of small 
objects. If I'd included functions to free the structures, I'd have had 
them free the strings they were passed.

	-Daniel
*This .sig left intentionally blank*
--
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]