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);
}
/* Just iterate over the implicit array */
ret = rit->impl_it;
rit->impl_it = rit->impl_it->next;
+
if (type & UCL_ITERATE_EXPLICIT) {
/* We flatten objects if need to expand values */
if (ret->type == UCL_OBJECT || ret->type == UCL_ARRAY) {
UCL_SAFE_ITER_CHECK (rit);
+ if (rit->expl_it != NULL) {
+ UCL_FREE (sizeof (*rit->expl_it), rit->expl_it);
+ }
+
UCL_FREE (sizeof (*rit), it);
}