From: Jeff King Date: Thu, 26 Feb 2009 14:37:29 GMT Subject: Re: [PATCH 08/21] remote: let guess_remote_head() optionally return all matches Message-ID: <20090226143729.GA9693@coredump.intra.peff.net> In-Reply-To: On Wed, Feb 25, 2009 at 03:32:15AM -0500, Jay Soffian wrote: > +struct ref *copy_ref_with_peer(const struct ref *src) > +{ > + struct ref *dst = copy_ref(src); > + dst->peer_ref = copy_ref(src->peer_ref); > + return dst; > +} Hmm. This should probably be: dst->peer_ref = src->peer_ref ? copy_ref(src->peer_ref) : NULL; (or copy_ref should return NULL when given NULL). I also wonder if the copied ref's peer_ref should be explicitly NULL'd. I don't think it matters for the current code, since we always feed it "matched refs" which have a peer, but I think it is good to be a little more defensive in such a generically-named function. And yes, this bug was in my original patch. :) -Peff