diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-12 11:17:08 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-12 11:17:08 +0100 |
commit | 43cad9b9ee5dab8dda2058cd4b6b4140699ce614 (patch) | |
tree | 4108a916c30af7c176402a4f34686d0d233d2b57 /src/rspamd.c | |
parent | 32c520263a035d7ea86bf223d8378633ce642f80 (diff) | |
download | rspamd-43cad9b9ee5dab8dda2058cd4b6b4140699ce614.tar.gz rspamd-43cad9b9ee5dab8dda2058cd4b6b4140699ce614.zip |
[Fix] Fix potential crash on reload
Diffstat (limited to 'src/rspamd.c')
-rw-r--r-- | src/rspamd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rspamd.c b/src/rspamd.c index 643d249b1..777726478 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -361,12 +361,15 @@ create_listen_socket (GPtrArray *addrs, guint cnt, g_ptr_array_sort (addrs, rspamd_inet_address_compare_ptr); for (i = 0; i < cnt; i ++) { + /* + * Copy address to avoid reload issues + */ if (listen_type & RSPAMD_WORKER_SOCKET_TCP) { fd = rspamd_inet_address_listen (g_ptr_array_index (addrs, i), SOCK_STREAM, TRUE); if (fd != -1) { ls = g_malloc0 (sizeof (*ls)); - ls->addr = g_ptr_array_index (addrs, i); + ls->addr = rspamd_inet_address_copy (g_ptr_array_index (addrs, i)); ls->fd = fd; ls->type = RSPAMD_WORKER_SOCKET_TCP; result = g_list_prepend (result, ls); @@ -377,7 +380,7 @@ create_listen_socket (GPtrArray *addrs, guint cnt, SOCK_DGRAM, TRUE); if (fd != -1) { ls = g_malloc0 (sizeof (*ls)); - ls->addr = g_ptr_array_index (addrs, i); + ls->addr = rspamd_inet_address_copy (g_ptr_array_index (addrs, i)); ls->fd = fd; ls->type = RSPAMD_WORKER_SOCKET_UDP; result = g_list_prepend (result, ls); |