diff --git a/src/options.zig b/src/options.zig index 3de2f29902..35972145fe 100644 --- a/src/options.zig +++ b/src/options.zig @@ -1909,8 +1909,13 @@ pub const BundleOptions = struct { this.defines_loaded = true; } - pub fn deinit(this: *const BundleOptions) void { + pub fn deinit(this: *BundleOptions, allocator: std.mem.Allocator) void { this.define.deinit(); + // Free bundler_feature_flags if it was allocated (not the static empty set) + if (this.bundler_feature_flags != &Runtime.Features.empty_bundler_feature_flags) { + @constCast(this.bundler_feature_flags).deinit(); + allocator.destroy(@constCast(this.bundler_feature_flags)); + } } pub fn loader(this: *const BundleOptions, ext: string) Loader { diff --git a/src/transpiler.zig b/src/transpiler.zig index 209f35804c..34990315a0 100644 --- a/src/transpiler.zig +++ b/src/transpiler.zig @@ -438,7 +438,7 @@ pub const Transpiler = struct { } pub fn deinit(this: *Transpiler) void { - this.options.deinit(); + this.options.deinit(this.allocator); this.log.deinit(); this.resolver.deinit(); this.fs.deinit();