Skip to content

Lightpanda: the headless browser designed for AI and automation

fix: Fix double-abort (and double free)

Karl Seguin04acafe17133
diff --git a/src/network/HttpClient.zig b/src/network/HttpClient.zig
index d5a466aec..c552c1e35 100644
--- a/src/network/HttpClient.zig
+++ b/src/network/HttpClient.zig
@@ -3063,6 +3063,12 @@ pub const Transfer = struct {
// to end a transfer. Don't reach for kill() or requestFailed() directly —
// they're internal helpers.
pub fn abort(self: *Transfer, err: anyerror) void {
+ if (self.state == .aborted) {
+ // Already detached mid-delivery (e.g. the owner was torn down from
+ // inside a callback); deliver() does the teardown.
+ return;
+ }
+
const page_scope = self.logScope();
defer page_scope.exit();