Skip to content

Commit

Permalink
Should close socket when allocation error occurs.
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee committed Jul 11, 2023
1 parent b6d8f93 commit 22c95c5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/std/http/Server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ pub const AcceptOptions = struct {
/// Accept a new connection.
pub fn accept(server: *Server, options: AcceptOptions) AcceptError!Response {
const in = try server.socket.accept();
errdefer in.stream.close();

var conn = try options.allocator.create(Connection);
conn.* = .{
Expand Down

0 comments on commit 22c95c5

Please sign in to comment.