mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +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>
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user