Skip to content

Commit

Permalink
When NativeCall is libffi, don't leak ffi_arg_types during GC
Browse files Browse the repository at this point in the history
body->ffi_arg_types is allocated with `MVM_malloc`, so needs a
corresponding `MVM_free`.
  • Loading branch information
nwc10 committed Nov 5, 2021
1 parent 6ff8155 commit a3c17d0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/6model/reprs/NativeCall.c
Expand Up @@ -165,6 +165,10 @@ static void gc_cleanup(MVMThreadContext *tc, MVMSTable *st, void *data) {
MVM_free(body->arg_info);
if (body->jitcode)
MVM_jit_code_destroy(tc, body->jitcode);
#ifdef HAVE_LIBFFI
if (body->ffi_arg_types)
MVM_free(body->ffi_arg_types);
#endif
}

static void gc_free(MVMThreadContext *tc, MVMObject *obj) {
Expand Down

0 comments on commit a3c17d0

Please sign in to comment.