Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-06-09 00:27:53 +0300
committerJunio C Hamano <gitster@pobox.com>2022-06-09 00:27:53 +0300
commitd2b11e05e0293befe7d6ef58fb4bb0fb65ec468a (patch)
tree9e8444977d91671638244ced19fec7a118e153ab
parent67c305f72290312e19113635023fed1e133d4f66 (diff)
parent6dfadc8981a3f2fd3fb552eb956fe12a542f8ee8 (diff)
Merge branch 'jc/clone-remote-name-leak-fix' into maint
"git clone --origin X" leaked piece of memory that held value read from the clone.defaultRemoteName configuration variable, which has been plugged. source: <xmqqlevl4ysk.fsf@gitster.g> * jc/clone-remote-name-leak-fix: clone: plug a miniscule leak
-rw-r--r--builtin/clone.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 5231656379..194d50f75f 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");