wasm-linker: Fix memory leak

This fixes a memory leak when an object file contains one or more element sections which
then contains one or more function indexes. This commit ensures the slice of index functions
for each element section will be freed upon resource deallocation also.
This commit is contained in:
Luuk de Gram
2022-04-12 21:43:16 +02:00
parent 2635e4ca6e
commit 321a164269

View File

@@ -133,6 +133,9 @@ pub fn deinit(self: *Object, gpa: Allocator) void {
gpa.free(self.memories);
gpa.free(self.globals);
gpa.free(self.exports);
for (self.elements) |el| {
gpa.free(el.func_indexes);
}
gpa.free(self.elements);
gpa.free(self.features);
for (self.relocations.values()) |val| {