diff --git a/src/dom/html_collection.zig b/src/dom/html_collection.zig
index c9e02b22..cbe309b0 100644
--- a/src/dom/html_collection.zig
+++ b/src/dom/html_collection.zig
@@ -73,6 +73,10 @@ pub const HTMLCollection = struct {
cur_idx: ?u32 = undefined,
cur_node: ?*parser.Node = undefined,
+ pub fn deinit(self: *HTMLCollection, allocator: std.mem.Allocator) void {
+ self.match.deinit(allocator);
+ }
+
// get_next iterates over the DOM tree to return the next following node or
// null at the end.
//