Skip to content

Commit 91aa673

Browse files
peffgitster
authored andcommitted
connect: clear child process before freeing in diagnostic mode
The git_connect() function has a special CONNECT_DIAG_URL mode, where we stop short of actually connecting to the other side and just print some parsing details. For URLs that require a child process (like ssh), we free() the child_process struct but forget to clear it, leaking the strings we stuffed into its "env" list. This leak is triggered many times in t5500, which uses "fetch-pack --diag-url", but we're not yet ready to mark it as leak-free. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6f54d00 commit 91aa673

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

connect.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,7 @@ struct child_process *git_connect(int fd[2], const char *url,
14851485

14861486
free(hostandport);
14871487
free(path);
1488+
child_process_clear(conn);
14881489
free(conn);
14891490
strbuf_release(&cmd);
14901491
return NULL;

0 commit comments

Comments
 (0)