diff --git a/src/Class.zig b/src/Class.zig index d5fb701..3d8175a 100644 --- a/src/Class.zig +++ b/src/Class.zig @@ -1378,9 +1378,9 @@ pub const AttributeInfo = struct { pub fn deinit(self: *ElementValue, allocator: std.mem.Allocator) void { switch (self.*) { - .annotation_value => |element_value| element_value.deinit(allocator), + .annotation_value => |*element_value| element_value.deinit(allocator), .array_value => |element_value| { - for (element_value.values) |value| { + for (element_value.values) |*value| { value.deinit(allocator); } allocator.free(element_value.values); @@ -1481,16 +1481,32 @@ pub const AttributeInfo = struct { .line_number_table => |attribute| allocator.free(attribute.line_number_table), .local_variable_table => |attribute| allocator.free(attribute.local_variable_table), .local_variable_type_table => |attribute| allocator.free(attribute.local_variable_type_table), - .runtime_visible_annotations => |attribute| allocator.free(attribute.annotations), - .runtime_invisible_annotations => |attribute| allocator.free(attribute.annotations), + .runtime_visible_annotations => |attribute| { + for (attribute.annotations) |*annotation| { + annotation.deinit(allocator); + } + allocator.free(attribute.annotations); + }, + .runtime_invisible_annotations => |attribute| { + for (attribute.annotations) |*annotation| { + annotation.deinit(allocator); + } + allocator.free(attribute.annotations); + }, .runtime_visible_parameter_annotations => |attribute| { for (attribute.parameter_annotations) |parameter_annotation| { + for (parameter_annotation.annotations) |*annotation| { + annotation.deinit(allocator); + } allocator.free(parameter_annotation.annotations); } allocator.free(attribute.parameter_annotations); }, .runtime_invisible_parameter_annotations => |attribute| { for (attribute.parameter_annotations) |parameter_annotation| { + for (parameter_annotation.annotations) |*annotation| { + annotation.deinit(allocator); + } allocator.free(parameter_annotation.annotations); } allocator.free(attribute.parameter_annotations);