From: Sebastian Harl Date: Wed, 17 Aug 2016 21:01:34 +0000 (+0200) Subject: SSL utils: Fixed a memory leak in a couple of error conditions. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=552cea4d7b8c031e9fe8d16e18ded82a8cbefd5a;p=sysdb.git SSL utils: Fixed a memory leak in a couple of error conditions. --- diff --git a/src/utils/ssl.c b/src/utils/ssl.c index c6a3fcb..fdb170d 100644 --- a/src/utils/ssl.c +++ b/src/utils/ssl.c @@ -399,6 +399,7 @@ sdb_ssl_server_create(const sdb_ssl_options_t *opts) server->opts.ca_file, NULL)) { ssl_log(SDB_LOG_ERR, "Failed to load CA file %s", server->opts.ca_file); + sdb_ssl_server_destroy(server); return NULL; } SSL_CTX_set_client_CA_list(server->ctx, @@ -408,16 +409,19 @@ sdb_ssl_server_create(const sdb_ssl_options_t *opts) server->opts.cert_file, SSL_FILETYPE_PEM)) { ssl_log(SDB_LOG_ERR, "Failed to load SSL cert file %s", server->opts.cert_file); + sdb_ssl_server_destroy(server); return NULL; } if (! SSL_CTX_use_PrivateKey_file(server->ctx, server->opts.key_file, SSL_FILETYPE_PEM)) { ssl_log(SDB_LOG_ERR, "Failed to load SSL key file %s", server->opts.key_file); + sdb_ssl_server_destroy(server); return NULL; } if (! SSL_CTX_check_private_key(server->ctx)) { ssl_log(SDB_LOG_ERR, "Failed to verify SSL private key"); + sdb_ssl_server_destroy(server); return NULL; }