From: Vsevolod Stakhov Date: Tue, 15 Mar 2016 14:56:25 +0000 (+0000) Subject: [Fix] Fix parsing upstreams from UCL X-Git-Tag: 1.2.0~41 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=addeca94a989343bc4339dd7fffac4bb3329aaa1;p=rspamd.git [Fix] Fix parsing upstreams from UCL --- diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index a49a8a222..9187ba9b9 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -651,17 +651,16 @@ rspamd_upstreams_from_ucl (struct upstream_list *ups, const ucl_object_t *cur; ucl_object_iter_t it = NULL; - if (ucl_object_type (in) == UCL_ARRAY) { - while ((cur = ucl_object_iterate (in, &it, true)) != NULL) { - if (rspamd_upstreams_from_ucl (ups, cur, def_port, data)) { - ret = TRUE; - } + it = ucl_object_iterate_new (in); + + while ((cur = ucl_object_iterate_safe (it, true)) != NULL) { + if (ucl_object_type (cur) == UCL_STRING) { + ret = rspamd_upstreams_parse_line (ups, ucl_object_tostring (cur), + def_port, data); } } - else if (ucl_object_type (in) == UCL_STRING) { - ret = rspamd_upstreams_parse_line (ups, ucl_object_tostring (in), - def_port, data); - } + + ucl_object_iterate_free (it); return ret; }