connect.c: do not leak "conn" after showing diagnosis
authorStefan Beller <sbeller@google.com>
Mon, 9 Mar 2015 16:58:22 +0000 (09:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Mar 2015 22:36:03 +0000 (15:36 -0700)
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>
connect.c
index ce0e1214234244236a407e9f3004e619d26c54a8..6090211fe9fad7fb3a2392e399976bc3ea528a4e 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -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");