Merge pull request #20 from utox39/fix/invalid-module-memory-leak

Fix a memory leak when the InvalidModule error occurs
This commit is contained in:
utox39
2025-10-04 18:06:07 +02:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -10,7 +10,7 @@
// This is a [Semantic Version](https://semver.org/). // This is a [Semantic Version](https://semver.org/).
// In a future version of Zig it will be used for package deduplication. // In a future version of Zig it will be used for package deduplication.
.version = "0.22.0", .version = "0.22.1",
// Together with name, this represents a globally unique package // Together with name, this represents a globally unique package
// identifier. This field is generated by the Zig toolchain when the // identifier. This field is generated by the Zig toolchain when the

View File

@@ -51,6 +51,7 @@ pub fn getModulesTypes(allocator: std.mem.Allocator, config: ?std.json.Parsed(Co
if (module_enum) |m| { if (module_enum) |m| {
try modules_list.append(m); try modules_list.append(m);
} else { } else {
modules_list.deinit();
return error.InvalidModule; return error.InvalidModule;
} }
} }