summaryrefslogtreecommitdiff
path: root/refspec.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-01 02:33:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-01 02:46:07 (GMT)
commitc3072c6e4db9130d0920bc8034f197624874de3d (patch)
treec10134658e193a3b684326d3189f9ba7c91e6eac /refspec.c
parent60fba4bf1670e6eabd61b04ebf86efedff866a50 (diff)
downloadgit-c3072c6e4db9130d0920bc8034f197624874de3d.zip
git-c3072c6e4db9130d0920bc8034f197624874de3d.tar.gz
git-c3072c6e4db9130d0920bc8034f197624874de3d.tar.bz2
refspec-api: avoid uninitialized field in refspec item
When parse_refspec() function was created at 3eec3700 ("refspec: factor out parsing a single refspec", 2018-05-16) to take a caller supplied piece of memory to fill parsed refspec_item, it forgot that a refspec without colon must set item->dst to NULL to let the users of refspec know that the result of the fetch does not get stored in an ref on our side. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refspec.c')
-rw-r--r--refspec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/refspec.c b/refspec.c
index 97e76e8..6e45365 100644
--- a/refspec.c
+++ b/refspec.c
@@ -48,6 +48,8 @@ static int parse_refspec(struct refspec_item *item, const char *refspec, int fet
size_t rlen = strlen(++rhs);
is_glob = (1 <= rlen && strchr(rhs, '*'));
item->dst = xstrndup(rhs, rlen);
+ } else {
+ item->dst = NULL;
}
llen = (rhs ? (rhs - lhs - 1) : strlen(lhs));