mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-09 15:19:13 +02:00
do memory freeing for CustomCommands
This commit is contained in:
parent
faefe686dc
commit
e5991abe13
1 changed files with 12 additions and 1 deletions
13
src/main.zig
13
src/main.zig
|
|
@ -217,7 +217,18 @@ pub fn main() !void {
|
|||
CustomCommands.mapping = .init(state.allocator);
|
||||
var config_parser = try IniParser(Config).init(state.allocator, config_path, migrator.configFieldHandler);
|
||||
defer config_parser.deinit();
|
||||
defer CustomCommands.mapping.deinit();
|
||||
// mapping.deinit() has to be done here
|
||||
defer {
|
||||
if (!shutdown or !restart) {
|
||||
var iter = CustomCommands.mapping.iterator();
|
||||
while (iter.next()) |i| {
|
||||
temporary_allocator.free(i.key_ptr.*);
|
||||
temporary_allocator.free(i.value_ptr.*.cmd);
|
||||
temporary_allocator.free(i.value_ptr.*.name);
|
||||
}
|
||||
CustomCommands.mapping.deinit();
|
||||
}
|
||||
}
|
||||
|
||||
state.config = config_parser.structure;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue