tests: Cleanup OpenSSL in the forked server processes

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-07-24 18:57:31 +02:00
committed by Andreas Schneider
parent c4c28c6473
commit 7eefbbd478
5 changed files with 74 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
*/
#include "test_server.h"
#include "testserver_common.h"
#include <libssh/priv.h>
#include <libssh/libssh.h>
@@ -288,6 +289,7 @@ int run_server(struct server_state_st *state)
free_server_state(state);
SAFE_FREE(state);
finalize_openssl();
exit(0);
case -1:
fprintf(stderr, "Failed to fork\n");
@@ -355,11 +357,8 @@ fork_run_server(struct server_state_st *state,
/* The child process starts a server which will listen for connections */
rc = run_server(state);
if (rc != 0) {
exit(rc);
}
exit(0);
finalize_openssl();
exit(rc);
case -1:
strerror_r(errno, err_str, 1024);
fprintf(stderr, "Failed to fork: %s\n",