aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libucl/ucl_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-26 15:57:43 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-03-26 15:57:43 +0000
commita5af7ff8d409b63743889c5562c7b735e19313a8 (patch)
tree19f2c2b60a455db000df12869de4bd9712bab88d /contrib/libucl/ucl_util.c
parentab4950c5eac19bd5d5aeac2a1c4772e9fd893f37 (diff)
downloadrspamd-a5af7ff8d409b63743889c5562c7b735e19313a8.tar.gz
rspamd-a5af7ff8d409b63743889c5562c7b735e19313a8.zip
[Minor] Apply all matching special handlers
Diffstat (limited to 'contrib/libucl/ucl_util.c')
-rw-r--r--contrib/libucl/ucl_util.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/contrib/libucl/ucl_util.c b/contrib/libucl/ucl_util.c
index 11799ab1e..6f36e5e73 100644
--- a/contrib/libucl/ucl_util.c
+++ b/contrib/libucl/ucl_util.c
@@ -520,18 +520,23 @@ void
ucl_chunk_free (struct ucl_chunk *chunk)
{
if (chunk) {
- if (chunk->special_handler) {
- if (chunk->special_handler->free_function) {
- chunk->special_handler->free_function (
- (unsigned char *) chunk->begin,
- chunk->end - chunk->begin,
- chunk->special_handler->user_data);
+ struct ucl_parser_special_handler_chain *chain, *tmp;
+
+ LL_FOREACH_SAFE (chunk->special_handlers, chain, tmp) {
+ if (chain->special_handler->free_function) {
+ chain->special_handler->free_function (
+ chain->begin,
+ chain->len,
+ chain->special_handler->user_data);
} else {
- UCL_FREE (chunk->end - chunk->begin,
- (unsigned char *) chunk->begin);
+ UCL_FREE (chain->len, chain->begin);
}
+
+ UCL_FREE (sizeof (*chain), chain);
}
+ chunk->special_handlers = NULL;
+
if (chunk->fname) {
free (chunk->fname);
}