summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-05-22 12:11:42 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-22 12:11:42 +0200
commit7cd4ba1b17d579134ac6cc172fc858021d4aa407 (patch)
tree6577897a31e21ce743c5f84425c729204e83341a /src
parenta6ea108b569073c6e8dc915f1757a34a461ab56e (diff)
downloadlibgit2-7cd4ba1b17d579134ac6cc172fc858021d4aa407.tar.gz
refspec: make sure matching refspecs have src, dst and input strings
When we find out that we're dealing with a matching refspec, we set the flag and return immediately. This leaves the strings as NULL, which breaks the contract. Assign these pointers to a string with the correct values.
Diffstat (limited to 'src')
-rw-r--r--src/refspec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/refspec.c b/src/refspec.c
index ad8141248..961f939c6 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -42,6 +42,12 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
*/
if (!is_fetch && rhs == lhs && rhs[1] == '\0') {
refspec->matching = 1;
+ refspec->string = git__strdup(input);
+ GITERR_CHECK_ALLOC(refspec->string);
+ refspec->src = git__strdup("");
+ GITERR_CHECK_ALLOC(refspec->src);
+ refspec->dst = git__strdup("");
+ GITERR_CHECK_ALLOC(refspec->dst);
return 0;
}