aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libucl
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 19:03:46 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-17 19:03:46 +0000
commite5da64bb8b631130fb2b2859d0b7034a14a46ce0 (patch)
treee3f6ceb87ddf8ea9d8d6b6edf492d7a0e2173460 /contrib/libucl
parent7da9a15f9be323beef5dd901ee49140173ef42f7 (diff)
downloadrspamd-e5da64bb8b631130fb2b2859d0b7034a14a46ce0.tar.gz
rspamd-e5da64bb8b631130fb2b2859d0b7034a14a46ce0.zip
[Fix] Fix memory leak in safe ucl iterators
Diffstat (limited to 'contrib/libucl')
-rw-r--r--contrib/libucl/ucl_util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/libucl/ucl_util.c b/contrib/libucl/ucl_util.c
index 6691c8546..a26d4748d 100644
--- a/contrib/libucl/ucl_util.c
+++ b/contrib/libucl/ucl_util.c
@@ -2501,6 +2501,11 @@ 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);
}
@@ -2509,6 +2514,7 @@ ucl_object_iterate_full (ucl_object_iter_t it, enum ucl_iterate_type 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) {
@@ -2527,6 +2533,10 @@ ucl_object_iterate_free (ucl_object_iter_t it)
UCL_SAFE_ITER_CHECK (rit);
+ if (rit->expl_it != NULL) {
+ UCL_FREE (sizeof (*rit->expl_it), rit->expl_it);
+ }
+
UCL_FREE (sizeof (*rit), it);
}