Skip to content

Commit

Permalink
Merge pull request #781 from pguyot/w34/fix-memory-allocation-in-erla…
Browse files Browse the repository at this point in the history
…ng-get_module_info-1

Fix a memory allocation bug in erlang:get_module_info/1
  • Loading branch information
fadushin authored Aug 25, 2023
2 parents 9a20507 + 60c98f1 commit cea1601
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libAtomVM/nifs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3395,7 +3395,7 @@ static term nif_erlang_get_module_info(Context *ctx, int argc, term argv[])
}
size_t info_size = module_get_exported_functions_list_size(target_module);
if (argc == 1) {
info_size += TUPLE_SIZE(2) + 3 * (TUPLE_SIZE(2) + CONS_SIZE);
info_size += 4 * (TUPLE_SIZE(2) + CONS_SIZE);
}
if (UNLIKELY(memory_ensure_free(ctx, info_size) != MEMORY_GC_OK)) {
RAISE_ERROR(OUT_OF_MEMORY_ATOM);
Expand Down

0 comments on commit cea1601

Please sign in to comment.