Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed memory leak of location_t.file_name. #956

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vunit/vhdl/check/src/checker_pkg-body.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ package body checker_pkg is
check_result.p_msg := new_string_ptr(string_pool, p_std_msg(std_fail_msg, msg, std_fail_ctx));
end if;

deallocate(location);
return check_result;
end;

Expand Down
5 changes: 5 additions & 0 deletions vunit/vhdl/logging/src/location_pkg-body-2008m.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ package body location_pkg is

return result;
end;

procedure deallocate(variable location : inout location_t) is
begin
deallocate(location.file_name);
end;
end package body;
5 changes: 5 additions & 0 deletions vunit/vhdl/logging/src/location_pkg-body-2019p.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ package body location_pkg is
swrite(result.file_name, "");
return result;
end;

procedure deallocate(variable location : inout location_t) is
begin
deallocate(location.file_name);
end;
end package body;
1 change: 1 addition & 0 deletions vunit/vhdl/logging/src/location_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ package location_pkg is
end record;

impure function get_location(path_offset, line_num : natural; file_name : string) return location_t;
procedure deallocate(variable location : inout location_t);
end package;
3 changes: 3 additions & 0 deletions vunit/vhdl/logging/src/logger_pkg-body.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ package body logger_pkg is
begin
if logger = null_logger then
core_failure("Attempt to log to uninitialized logger");
deallocate(location);
return;
end if;

Expand All @@ -913,6 +914,8 @@ package body logger_pkg is
-- Count even if disabled
count_log(logger, log_level);
end if;

deallocate(location);
end procedure;

procedure debug(logger : logger_t;
Expand Down