From e79933990d58354192a50a96a8934d84f4972ef0 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Fri, 9 Feb 2024 11:35:43 +0100 Subject: [PATCH] xhr: destroy allocated mem on error --- src/xhr/xhr.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xhr/xhr.zig b/src/xhr/xhr.zig index d0dc7fb1..391660ec 100644 --- a/src/xhr/xhr.zig +++ b/src/xhr/xhr.zig @@ -341,12 +341,14 @@ pub const XMLHttpRequest = struct { .total = opts.total, .loaded = opts.loaded, }) catch |e| { + self.alloc.destroy(evt); return log.err("construct progress event: {any}", .{e}); }; _ = parser.eventTargetDispatchEvent( @as(*parser.EventTarget, @ptrCast(self)), @as(*parser.Event, @ptrCast(evt)), ) catch |e| { + self.alloc.destroy(evt); return log.err("dispatch progress event: {any}", .{e}); }; }