Skip to content

Commit d2b11e0

Browse files
committed
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: <[email protected]> * jc/clone-remote-name-leak-fix: clone: plug a miniscule leak
2 parents 67c305f + 6dfadc8 commit d2b11e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

builtin/clone.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
11061106
* apply the remote name provided by --origin only after this second
11071107
* call to git_config, to ensure it overrides all config-based values.
11081108
*/
1109-
if (option_origin != NULL)
1109+
if (option_origin != NULL) {
1110+
free(remote_name);
11101111
remote_name = xstrdup(option_origin);
1112+
}
11111113

11121114
if (remote_name == NULL)
11131115
remote_name = xstrdup("origin");

0 commit comments

Comments
 (0)