From: Vsevolod Stakhov Date: Fri, 27 Jan 2017 18:02:58 +0000 (+0000) Subject: [Fix] Fix memory leak in HTTP maps X-Git-Tag: 1.5.0~230 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=944588e26acadaaf7d68fd4798142e8a754fa9d3;p=rspamd.git [Fix] Fix memory leak in HTTP maps Issue: #1332 --- diff --git a/src/libutil/map.c b/src/libutil/map.c index 6fb04d4e5..72939aa7f 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -97,7 +97,8 @@ write_http_request (struct http_callback_data *cbd) } if (cbd->stage == map_load_file) { - msg->url = rspamd_fstring_new_init (cbd->data->path, strlen (cbd->data->path)); + msg->url = rspamd_fstring_append (msg->url, + cbd->data->path, strlen (cbd->data->path)); if (cbd->check && cbd->data->last_checked != 0 && cbd->stage == map_load_file) { @@ -107,11 +108,13 @@ write_http_request (struct http_callback_data *cbd) } } else if (cbd->stage == map_load_pubkey) { - msg->url = rspamd_fstring_new_init (cbd->data->path, strlen (cbd->data->path)); + msg->url = rspamd_fstring_append (msg->url, + cbd->data->path, strlen (cbd->data->path)); msg->url = rspamd_fstring_append (msg->url, ".pub", 4); } else if (cbd->stage == map_load_signature) { - msg->url = rspamd_fstring_new_init (cbd->data->path, strlen (cbd->data->path)); + msg->url = rspamd_fstring_append (msg->url, + cbd->data->path, strlen (cbd->data->path)); msg->url = rspamd_fstring_append (msg->url, ".sig", 4); } else { diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c index c320dfd29..9913e48d3 100644 --- a/src/libutil/ssl_util.c +++ b/src/libutil/ssl_util.c @@ -16,6 +16,7 @@ #include "config.h" #include "libutil/util.h" +#include "libutil/logger.h" #include "ssl_util.h" #include @@ -362,7 +363,7 @@ rspamd_ssl_event_handler (gint fd, short what, gpointer ud) c->handler (fd, EV_WRITE, c->handler_data); } else { - g_assert (0); + return; } } else { @@ -700,6 +701,7 @@ void rspamd_ssl_connection_free (struct rspamd_ssl_connection *conn) { if (conn) { + SSL_shutdown (conn->ssl); SSL_free (conn->ssl); if (conn->hostname) {