]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix memory leak in HTTP maps
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Jan 2017 18:02:58 +0000 (18:02 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 29 Jan 2017 17:34:38 +0000 (17:34 +0000)
Issue: #1332

src/libutil/map.c
src/libutil/ssl_util.c

index 439a13e9495b991b732480c10fe649e0c36868d3..af83cc4d13cc46c10ac52f0b046b9e8cbad1bee5 100644 (file)
@@ -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 {
index 6f00e16216b7d2d1f34aa07d96d8c76bed427e21..828250e5015d673c31fc88ea90295db7cf74f9db 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "config.h"
 #include "libutil/util.h"
+#include "libutil/logger.h"
 #include "ssl_util.h"
 
 #include <openssl/ssl.h>
@@ -365,7 +366,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 {
@@ -703,6 +704,7 @@ void
 rspamd_ssl_connection_free (struct rspamd_ssl_connection *conn)
 {
        if (conn) {
+               SSL_shutdown (conn->ssl);
                SSL_free (conn->ssl);
 
                if (conn->hostname) {