Re: [PATCH] Fix broken sha1 locking

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

 




On Tue, 19 Sep 2006, Petr Baudis wrote:
>
> lock_ref_sha1_basic() never strdup()s ref (at least the reference used
> for git_path() later).

Ahh. So how did that ever work? Even in the current "master" branch, we 
call "resolve_ref()", which calls "git_path()", and historically we only 
had a single buffer..

So we're doing

	lock_ref_sha1_basic(git_path("refs/%s", ref),...

with that single buffer, and we _do_ do "xstrdup(path)" in between.

[ looks.. ]

Ahh.

We re-assign the "path" to point to the result value of the resolve_ref(), 
and so we do re-use the buffer, but we apparently never have any 
overlapping use. The packed-ref changes make us need pathnames in the 
middle, which we didn't use to do.

I do agree that we tend to use too many static buffers there. The static 
buffers are fine for the low-level functions ("mkpath()" and 
"git_path()"), but once they start getting passed around as arguments to 
other functions, they should be xstrdup'd or something.

		Linus
-
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]