summaryrefslogtreecommitdiffhomepage
path: root/examples/state-reuse.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-08-24 16:35:51 +0200
committerJo-Philipp Wich <jo@mein.io>2022-08-24 16:37:11 +0200
commitbcdd2cb33797412cce1f1014d265a71461676cff (patch)
tree24f66afaedf7e9aa9c59c19640635fca5ffe0c1b /examples/state-reuse.c
parentee1946fad8a81b1917052292accafe91b7a1bb89 (diff)
examples: add module search path initialization and freeing
Since commit 3c168b5 ("vm, cli: move search path into global config...") it is required to explicitly initialize the module search path in the configuration structure for compile time module imports and run time require operations to work. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'examples/state-reuse.c')
-rw-r--r--examples/state-reuse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/state-reuse.c b/examples/state-reuse.c
index f7321f6..c685e48 100644
--- a/examples/state-reuse.c
+++ b/examples/state-reuse.c
@@ -60,6 +60,9 @@ int main(int argc, char **argv)
return 1;
}
+ /* initialize default module search path */
+ uc_search_path_init(&config.module_search_path);
+
/* initialize VM context */
uc_vm_t vm = { 0 };
uc_vm_init(&vm, &config);
@@ -91,5 +94,8 @@ int main(int argc, char **argv)
/* free VM context */
uc_vm_free(&vm);
+ /* free search module path vector */
+ uc_search_path_free(&config.module_search_path);
+
return exit_code;
}