miniupnpd: free OpenSSL memory

This commit is contained in:
Thomas Bernard 2014-04-09 16:09:31 +02:00
parent e91bda48d7
commit e26174d05d
3 changed files with 24 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: miniupnpd.c,v 1.192 2014/04/09 11:07:36 nanard Exp $ */
/* $Id: miniupnpd.c,v 1.193 2014/04/09 14:08:11 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard
@ -2324,6 +2324,9 @@ shutdown:
free(lan_addr);
}
#ifdef ENABLE_HTTPS
free_ssl();
#endif
#ifdef ENABLE_NATPMP
free(snatpmp);
#endif

View File

@ -1,4 +1,4 @@
/* $Id: upnphttp.c,v 1.90 2014/04/09 13:15:43 nanard Exp $ */
/* $Id: upnphttp.c,v 1.91 2014/04/09 14:08:12 nanard Exp $ */
/* Project : miniupnp
* Website : http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* Author : Thomas Bernard
@ -31,6 +31,8 @@
#ifdef ENABLE_HTTPS
#include <openssl/err.h>
#include <openssl/engine.h>
#include <openssl/conf.h>
static SSL_CTX *ssl_ctx = NULL;
#ifndef HTTPS_CERTFILE
@ -87,6 +89,21 @@ int init_ssl(void)
}
return 0;
}
void free_ssl(void)
{
/* free context */
if(ssl_ctx != NULL) {
SSL_CTX_free(ssl_ctx);
ssl_ctx = NULL;
}
ERR_remove_state(0);
ENGINE_cleanup();
CONF_modules_unload(1);
ERR_free_strings();
EVP_cleanup();
CRYPTO_cleanup_all_ex_data();
}
#endif /* ENABLE_HTTPS */
struct upnphttp *

View File

@ -1,4 +1,4 @@
/* $Id: upnphttp.h,v 1.37 2014/04/09 13:15:45 nanard Exp $ */
/* $Id: upnphttp.h,v 1.38 2014/04/09 14:08:13 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2014 Thomas Bernard
@ -110,6 +110,7 @@ struct upnphttp {
#ifdef ENABLE_HTTPS
int init_ssl(void);
void free_ssl(void);
#endif /* ENABLE_HTTPS */
/* New_upnphttp() */