1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-14 21:20:58 +03:00

test: Fix potential leak of fds on error

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Norbert Pocs <norbertpocs0@gmail.com>
(cherry picked from commit f0b9db586b)
This commit is contained in:
Jakub Jelen
2025-04-16 16:39:17 +02:00
parent 0de97c48d0
commit a2bb9b5d0c

View File

@ -125,12 +125,14 @@ int run_server(struct server_state_st *state)
if (fd == -1) {
fprintf(stderr, "dup2 of log file to stderr failed: %s\n",
strerror(errno));
fclose(f);
goto out;
}
fd = dup2(fileno(f), STDOUT_FILENO);
if (fd == -1) {
fprintf(stderr, "dup2 of log file to stdout failed: %s\n",
strerror(errno));
fclose(f);
goto out;
}
fclose(f);