[PATCH 5/6] connect: don't xstrdup target_host
- From
Mike Hommey <mh@glandium.org>
- Date
- May 1, 2016, 06:02 UTC
- Message-ID
- <1462082573-17992-6-git-send-email-mh@glandium.org>
- In-Reply-To
- <1462082573-17992-1-git-send-email-mh@glandium.org>
Now that hostandport is left unmodified in git_connect (we don't pass it to get_host_and_port() anymore), we can avoid xstrdup'ing it.
Signed-off-by: Mike Hommey <mh@glandium.org> --- connect.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/connect.c b/connect.c index b3fce84..e2b976e 100644 --- a/connect.c +++ b/connect.c @@ -683,9 +683,9 @@ struct child_process *git_connect(int fd[2], const char *url, */ char *target_host = getenv("GIT_OVERRIDE_VIRTUAL_HOST"); if (target_host) - target_host = xstrdup(target_host); + target_host = target_host; else - target_host = xstrdup(hostandport); + target_host = hostandport; transport_check_allowed("git"); @@ -707,7 +707,6 @@ struct child_process *git_connect(int fd[2], const char *url, "%s %s%chost=%s%c", prog, path, 0, target_host, 0); - free(target_host); } else { conn = xmalloc(sizeof(*conn)); child_process_init(conn);
-- 2.8.1.16.g58dac65.dirty