Skip to content

Commit 1a88104

Browse files
authored
Remove module instance from hashmap in wasi_nn_destroy (#2613)
When destroying wasi-nn context, module instance should be also removed from hashmap to avoid memory leak.
1 parent e1ea15d commit 1a88104

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/iwasm/libraries/wasi-nn/src/wasi_nn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ void
163163
wasi_nn_destroy(wasm_module_inst_t instance)
164164
{
165165
WASINNContext *wasi_nn_ctx = wasm_runtime_get_wasi_nn_ctx(instance);
166+
bh_hash_map_remove(hashmap, (void *)instance, NULL, NULL);
166167
wasi_nn_ctx_destroy(wasi_nn_ctx);
167168
}
168169

0 commit comments

Comments
 (0)