summaryrefslogtreecommitdiffstats
path: root/contrib/libucl/ucl_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libucl/ucl_util.c')
-rw-r--r--contrib/libucl/ucl_util.c7
1 files 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;