summaryrefslogtreecommitdiffstats
path: root/src/libutil/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/map.c')
-rw-r--r--src/libutil/map.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c
index 3a7cdc032..361abcee4 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -1628,7 +1628,9 @@ rspamd_map_add_from_ucl (struct rspamd_config *cfg,
if (ucl_object_type (elt) == UCL_ARRAY) {
/* Add array of maps as multiple backends */
- while ((cur = ucl_object_iterate (elt, &it, true)) != NULL) {
+ it = ucl_object_iterate_new (elt);
+
+ while ((cur = ucl_object_iterate_safe (it, true)) != NULL) {
if (ucl_object_type (cur) == UCL_STRING) {
bk = rspamd_map_parse_backend (cfg, ucl_object_tostring (cur));
@@ -1643,10 +1645,13 @@ rspamd_map_add_from_ucl (struct rspamd_config *cfg,
else {
msg_err_config ("bad map element type: %s",
ucl_object_type_to_string (ucl_object_type (cur)));
+ ucl_object_iterate_free (it);
goto err;
}
}
+ ucl_object_iterate_free (it);
+
if (map->backends->len == 0) {
msg_err_config ("map has no urls to be loaded: empty object list");
goto err;