add some missing initializations
[project/uci.git] / libuci.c
index 5b5db54..1cfe4ec 100644 (file)
--- a/libuci.c
+++ b/libuci.c
@@ -56,7 +56,7 @@ struct uci_context *uci_alloc_context(void)
        uci_list_init(&ctx->root);
        uci_list_init(&ctx->history_path);
        uci_list_init(&ctx->backends);
-       ctx->flags = UCI_FLAG_STRICT;
+       ctx->flags = UCI_FLAG_STRICT | UCI_FLAG_SAVED_HISTORY;
 
        ctx->confdir = (char *) uci_confdir;
        ctx->savedir = (char *) uci_savedir;
@@ -85,8 +85,8 @@ void uci_free_context(struct uci_context *ctx)
        uci_foreach_element_safe(&ctx->history_path, tmp, e) {
                uci_free_element(e);
        }
-       free(ctx);
        UCI_TRAP_RESTORE(ctx);
+       free(ctx);
 
 ignore:
        return;