Skip to content

Commit

Permalink
connect.c: do not leak "conn" after showing diagnosis
Browse files Browse the repository at this point in the history
When git_connect() is called to see how the URL is parsed for
debugging purposes with CONNECT_DIAG_URL set, the variable conn is
leaked.  At this point in the codeflow, it only has its memory and
no other resource is associated with it, so it is sufficient to
clean it up by just freeing it.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
stefanbeller authored and gitster committed Mar 10, 2015
1 parent 7a9409c commit 04f20c0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ struct child_process *git_connect(int fd[2], const char *url,

free(hostandport);
free(path);
free(conn);
return NULL;
} else {
ssh = getenv("GIT_SSH_COMMAND");
Expand Down

0 comments on commit 04f20c0

Please sign in to comment.