]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] More fixes for iterators cleanup
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Jan 2017 19:19:34 +0000 (19:19 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Jan 2017 19:19:34 +0000 (19:19 +0000)
contrib/libucl/ucl_util.c

index a26d4748d24820d2dd6bf4cc285dbbc09667f226..7fcfe2e6ed9e8064aaff23355f42fa1d3a756cb0 100644 (file)
@@ -2470,6 +2470,10 @@ ucl_object_iterate_reset (ucl_object_iter_t it, const ucl_object_t *obj)
 
        UCL_SAFE_ITER_CHECK (rit);
 
+       if (rit->expl_it != NULL) {
+               UCL_FREE (sizeof (*rit->expl_it), rit->expl_it);
+       }
+
        rit->impl_it = obj;
        rit->expl_it = NULL;
 
@@ -2501,12 +2505,8 @@ ucl_object_iterate_full (ucl_object_iter_t it, enum ucl_iterate_type type)
                if (ret == NULL && (type & UCL_ITERATE_IMPLICIT)) {
                        /* Need to switch to another implicit object in chain */
                        rit->impl_it = rit->impl_it->next;
-
-                       if (rit->expl_it != NULL) {
-                               UCL_FREE (sizeof (*rit->expl_it), rit->expl_it);
-                       }
-
                        rit->expl_it = NULL;
+
                        return ucl_object_iterate_safe (it, type);
                }
        }