diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-17 19:19:47 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-17 19:19:47 +0000 |
commit | 7d40df5184f0aa6facde77e088d0751d4c475c6a (patch) | |
tree | 8c54b8eb817da0dee480bebd66d46bd83ee73898 /src/rspamd_proxy.c | |
parent | 6eec897d8c3e01159556f41b8bb938cacfc0c084 (diff) | |
download | rspamd-7d40df5184f0aa6facde77e088d0751d4c475c6a.tar.gz rspamd-7d40df5184f0aa6facde77e088d0751d4c475c6a.zip |
[Fix] Various reload leak fixing
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r-- | src/rspamd_proxy.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c index df92dab1c..33ac428af 100644 --- a/src/rspamd_proxy.c +++ b/src/rspamd_proxy.c @@ -296,9 +296,7 @@ rspamd_proxy_parse_upstream (rspamd_mempool_t *pool, return FALSE; } - up = g_malloc0 (sizeof (*up)); - rspamd_mempool_add_destructor (pool, - (rspamd_mempool_destruct_t)g_free, up); + up = rspamd_mempool_alloc0 (pool, sizeof (*up)); up->parser_from_ref = -1; up->parser_to_ref = -1; up->name = rspamd_mempool_strdup (pool, ucl_object_tostring (elt)); @@ -365,6 +363,9 @@ rspamd_proxy_parse_upstream (rspamd_mempool_t *pool, &up->parser_to_ref, err)) { goto err; } + + rspamd_lua_add_ref_dtor (L, pool, up->parser_from_ref); + rspamd_lua_add_ref_dtor (L, pool, up->parser_to_ref); } double_to_tv (up->timeout, &up->io_tv); @@ -408,9 +409,7 @@ rspamd_proxy_parse_mirror (rspamd_mempool_t *pool, return FALSE; } - up = g_malloc0 (sizeof (*up)); - rspamd_mempool_add_destructor (pool, - (rspamd_mempool_destruct_t)g_free, up); + up = rspamd_mempool_alloc0 (pool, sizeof (*up)); up->name = rspamd_mempool_strdup (pool, ucl_object_tostring (elt)); up->parser_to_ref = -1; up->parser_from_ref = -1; @@ -480,6 +479,9 @@ rspamd_proxy_parse_mirror (rspamd_mempool_t *pool, &up->parser_to_ref, err)) { goto err; } + + rspamd_lua_add_ref_dtor (L, pool, up->parser_from_ref); + rspamd_lua_add_ref_dtor (L, pool, up->parser_to_ref); } elt = ucl_object_lookup_any (obj, "settings", "settings_id", NULL); |