aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http_client_async.zig12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig
index f06474219..01419cafd 100644
--- a/src/http_client_async.zig
+++ b/src/http_client_async.zig
@@ -1324,10 +1324,7 @@ pub const InternalState = struct {
reader.deinit();
}
- // if we are holding a cloned_metadata we need to deinit it
- // this should never happen because we should always return the metadata to the user
- std.debug.assert(this.cloned_metadata == null);
- // just in case we check and free to avoid leaks
+
if (this.cloned_metadata != null) {
this.cloned_metadata.?.deinit(allocator);
this.cloned_metadata = null;
@@ -2865,10 +2862,6 @@ fn fail(this: *HTTPClient, err: anyerror) void {
if (this.signals.aborted != null) {
_ = socket_async_http_abort_tracker.swapRemove(this.async_http_id);
}
-
- this.state.reset(this.allocator);
- this.proxy_tunneling = false;
-
this.state.request_stage = .fail;
this.state.response_stage = .fail;
this.state.fail = err;
@@ -2876,6 +2869,9 @@ fn fail(this: *HTTPClient, err: anyerror) void {
const callback = this.result_callback;
const result = this.toResult();
+ this.state.reset(this.allocator);
+ this.proxy_tunneling = false;
+
callback.run(result);
}