summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-05-04 16:51:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-05-04 16:51:28 (GMT)
commit8ed16bd600b0fd8e0ac0090e0dc8375614cc0ba8 (patch)
treee562fad8986a2e5f996e62fe11e82a866366ae55 /builtin
parent5048b20d1c2db7525e4739a75e2f89c1b96ad116 (diff)
parent6dfadc8981a3f2fd3fb552eb956fe12a542f8ee8 (diff)
downloadgit-8ed16bd600b0fd8e0ac0090e0dc8375614cc0ba8.zip
git-8ed16bd600b0fd8e0ac0090e0dc8375614cc0ba8.tar.gz
git-8ed16bd600b0fd8e0ac0090e0dc8375614cc0ba8.tar.bz2
Merge branch 'jc/clone-remote-name-leak-fix'
"git clone --origin X" leaked piece of memory that held value read from the clone.defaultRemoteName configuration variable, which has been plugged. * jc/clone-remote-name-leak-fix: clone: plug a miniscule leak
Diffstat (limited to 'builtin')
-rw-r--r--builtin/clone.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 5231656..194d50f 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1106,8 +1106,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
* apply the remote name provided by --origin only after this second
* call to git_config, to ensure it overrides all config-based values.
*/
- if (option_origin != NULL)
+ if (option_origin != NULL) {
+ free(remote_name);
remote_name = xstrdup(option_origin);
+ }
if (remote_name == NULL)
remote_name = xstrdup("origin");