Re: [PATCH v2 0/25] prune-safety
- From
Jeff King <peff@peff.net>
- Date
- Oct 18, 2014, 12:31 UTC
- Message-ID
- <20141018123106.GA5494@peff.net>
- In-Reply-To
- <20141016213918.GA29397@peff.net>
On Thu, Oct 16, 2014 at 05:39:18PM -0400, Jeff King wrote:
Show 12 quoted lines
> @@ -301,6 +297,14 @@ static struct commit *handle_commit(struct rev_info *revs,
> die("bad object %s", sha1_to_hex(tag->tagged->sha1));
> }
> object->flags |= flags;
> + /*
> + * We'll handle the tagged object by looping or dropping
> + * through to the non-tag handlers below. Do not
> + * propagate data from the tag's pending entry.
> + */
> + name = NULL;
> + path = NULL;
> + mode = 0;Hmm. On second thought (and after seeing a warning from Coverity), this should be:
diff --git a/revision.c b/revision.c index 8030fc8..ebe3e93 100644 --- a/revision.c +++ b/revision.c @@ -302,7 +302,7 @@ static struct commit *handle_commit(struct rev_info *revs, * through to the non-tag handlers below. Do not * propagate data from the tag's pending entry. */ - name = NULL; + name = ""; path = NULL; mode = 0; } The rest of the function assumes that name is not NULL (which I'm not sure is entirely safe, as add_pending_object can take a NULL; presumably every "add" uses the empty string instead of NULL. But either way, setting it to NULL here is definite wrong). The "path" field is explicitly OK to be NULL. -Peff