1
0
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:
nicm 2015-09-24 12:06:20 +00:00
parent 69ea6b9373
commit 2a62917444

View File

@ -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);
} }