diff --git a/lib/c-api/examples/exports-global.c b/lib/c-api/examples/exports-global.c index f9cae061e..ff20dfdef 100644 --- a/lib/c-api/examples/exports-global.c +++ b/lib/c-api/examples/exports-global.c @@ -103,12 +103,15 @@ int main(int argc, const char* argv[]) { wasmer_last_error_message(error_message, error_length); printf("Attempted to set an immutable global: `%s`\n", error_message); + free(error_message); } wasm_val_t some_set_value = WASM_F32_VAL(21); wasm_global_set(some, &some_set_value); printf("`some` value: %.1f\n", some_value.of.f32); + wasm_globaltype_delete(one_type); + wasm_globaltype_delete(some_type); wasm_module_delete(module); wasm_extern_vec_delete(&exports); wasm_instance_delete(instance); diff --git a/lib/c-api/examples/imports-exports.c b/lib/c-api/examples/imports-exports.c index 0e33e560b..aaf4186c3 100644 --- a/lib/c-api/examples/imports-exports.c +++ b/lib/c-api/examples/imports-exports.c @@ -63,6 +63,7 @@ int main(int argc, const char* argv[]) { printf("Instantiating module...\n"); wasm_instance_t* instance = wasm_instance_new(store, module, &import_object, NULL); + wasm_extern_vec_delete(&import_object); if (!instance) { printf("> Error instantiating module!\n"); diff --git a/lib/c-api/examples/instance.c b/lib/c-api/examples/instance.c index 843b94d21..6eb867d4c 100644 --- a/lib/c-api/examples/instance.c +++ b/lib/c-api/examples/instance.c @@ -15,6 +15,7 @@ int main(int argc, const char* argv[]) { wasm_byte_vec_new(&wat, strlen(wat_string), wat_string); wasm_byte_vec_t wasm_bytes; wat2wasm(&wat, &wasm_bytes); + wasm_byte_vec_delete(&wat); printf("Creating the store...\n"); wasm_engine_t* engine = wasm_engine_new(); diff --git a/lib/c-api/examples/wasi.c b/lib/c-api/examples/wasi.c index 1c895e302..e3047912d 100644 --- a/lib/c-api/examples/wasi.c +++ b/lib/c-api/examples/wasi.c @@ -69,13 +69,7 @@ int main(int argc, const char* argv[]) { // Instantiate. printf("Instantiating module...\n"); - wasm_importtype_vec_t import_types; - wasm_module_imports(module, &import_types); - wasm_extern_vec_t imports; - wasm_extern_vec_new_uninitialized(&imports, import_types.size); - wasm_importtype_vec_delete(&import_types); - bool get_imports_result = wasi_get_imports(store, module, wasi_env, &imports); if (!get_imports_result) { @@ -153,6 +147,7 @@ int main(int argc, const char* argv[]) { fclose(memory_stream); printf("WASI Stdout: `%.*s`\n", (int) stdout_size, stdout); + free(stdout); }