aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-14 17:26:22 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-14 17:26:22 +0100
commitd168084c5a7830353786e466b484a9db7d36b6c6 (patch)
treef60102b562daa05558675b3d52b7be98ba5d805e
parent2ffba6be3740d5c3f8fe03a6a742310f6b770cff (diff)
downloadrspamd-d168084c5a7830353786e466b484a9db7d36b6c6.tar.gz
rspamd-d168084c5a7830353786e466b484a9db7d36b6c6.zip
[Minor] Fix more init/deinit leaks
-rw-r--r--src/libserver/cfg_utils.c9
-rw-r--r--src/libutil/addr.c4
-rw-r--r--src/lua/lua_map.c2
3 files changed, 12 insertions, 3 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index ef5d89ff6..cf7f8d847 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -1913,6 +1913,8 @@ rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
ucl_object_key (obj));
return FALSE;
}
+
+ return TRUE;
}
else {
/* Just a list */
@@ -1935,6 +1937,8 @@ rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
EINVAL, "bad map object for %s", ucl_object_key (obj));
return FALSE;
}
+
+ return TRUE;
break;
case UCL_ARRAY:
/* List of IP addresses */
@@ -1961,6 +1965,11 @@ rspamd_config_radix_from_ucl (struct rspamd_config *cfg,
}
}
+ /* Destroy on cfg cleanup */
+ rspamd_mempool_add_destructor (cfg->cfg_pool,
+ (rspamd_mempool_destruct_t)rspamd_map_helper_destroy_radix,
+ *target);
+
return TRUE;
}
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index dee5fbbb2..a00d2a86b 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -1752,9 +1752,7 @@ rspamd_inet_library_init (void)
void
rspamd_inet_library_destroy (void)
{
- if (local_addrs != NULL) {
- rspamd_map_helper_destroy_radix (local_addrs);
- }
+ /* Ugly: local_addrs will actually be freed by config object */
}
gsize
diff --git a/src/lua/lua_map.c b/src/lua/lua_map.c
index d5914706c..d3fc8edb9 100644
--- a/src/lua/lua_map.c
+++ b/src/lua/lua_map.c
@@ -277,11 +277,13 @@ lua_config_radix_from_ucl (lua_State *L)
msg_err_config ("invalid radix map static");
lua_pushnil (L);
ucl_object_unref (fake_obj);
+ ucl_object_unref (obj);
return 1;
}
ucl_object_unref (fake_obj);
+ ucl_object_unref (obj);
pmap = lua_newuserdata (L, sizeof (void *));
map->map = m;
m->lua_map = map;