mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Don't leak fd and path on failure.
This commit is contained in:
parent
69ea6b9373
commit
2a62917444
6
client.c
6
client.c
@ -153,15 +153,19 @@ retry:
|
|||||||
}
|
}
|
||||||
fd = server_start(base, lockfd, lockfile);
|
fd = server_start(base, lockfd, lockfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locked) {
|
if (locked) {
|
||||||
free(lockfile);
|
free(lockfile);
|
||||||
close(lockfd);
|
close(lockfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
setblocking(fd, 0);
|
setblocking(fd, 0);
|
||||||
return (fd);
|
return (fd);
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
if (locked) {
|
||||||
|
free(lockfile);
|
||||||
|
close(lockfd);
|
||||||
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user