Skip to content

Fix memory leak in mono/mini/aot-compiler.c#126308

Open
dovydenkovas wants to merge 1 commit into
dotnet:mainfrom
dovydenkovas:fix-memory-leak-in-aot-compiler
Open

Fix memory leak in mono/mini/aot-compiler.c#126308
dovydenkovas wants to merge 1 commit into
dotnet:mainfrom
dovydenkovas:fix-memory-leak-in-aot-compiler

Conversation

@dovydenkovas
Copy link
Copy Markdown
Contributor

@dovydenkovas dovydenkovas commented Mar 30, 2026

The GString export_symbols is removed in only one execution branch. Freeing does not occur unless the icfg->aot_opts.export_symbols_outfile field is set, which is set in only one place: aot-compiler.c function mono_aot_parse_options: opts->export_symbols_outfile = g_strdup (arg + strlen ("export-symbols-outfile="));.

The error only occurs during compilation with an empty export-symbols-outfile= option. The maximum loss is 16 bytes per compilation.

Signed-off-by: Aleksandr Dovydenkov asd@altlinux.org
Found by Linux Verification Center (linuxtesting.org) with SVACE.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Mar 30, 2026
@dovydenkovas dovydenkovas force-pushed the fix-memory-leak-in-aot-compiler branch from 8a51be5 to 12ec34b Compare April 8, 2026 11:58
Free GString export_symbols that allocates
in add_native_to_managed_wrappers with a
minimum size of 16 bytes.

Signed-off-by: Aleksandr Dovydenkov <asd@altlinux.org>
Found by Linux Verification Center (linuxtesting.org) with SVACE.
@dovydenkovas dovydenkovas force-pushed the fix-memory-leak-in-aot-compiler branch from 2806695 to 89064be Compare June 8, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Codegen-AOT-mono community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant