xhr: destroy allocated mem on error

This commit is contained in:
Pierre Tachoire
2024-02-09 11:35:43 +01:00
parent 76df0a1ff7
commit e79933990d

View File

@@ -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});
};
}