From e1aaa10d62d8ec23b6980b78fdda3fa16b1f4f3c Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 11 Mar 2015 11:57:17 +0000 Subject: [PATCH] Backport fix from libucl. --- contrib/libucl/ucl_util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/libucl/ucl_util.c b/contrib/libucl/ucl_util.c index 41e012bf1..c409e3f6f 100644 --- a/contrib/libucl/ucl_util.c +++ b/contrib/libucl/ucl_util.c @@ -917,6 +917,10 @@ ucl_include_file_single (const unsigned char *data, size_t len, } /* Restore old file vars */ + if (parser->cur_file) { + free (parser->cur_file); + } + parser->cur_file = old_curfile; DL_FOREACH_SAFE (parser->variables, cur_var, tmp_var) { if (strcmp (cur_var->var, "CURDIR") == 0 && old_curdir) { @@ -938,9 +942,6 @@ ucl_include_file_single (const unsigned char *data, size_t len, if (old_curdir) { DL_APPEND (parser->variables, old_curdir); } - if (old_curfile) { - free (old_curfile); - } parser->state = prev_state; -- 2.39.5