Skip to content

Commit

Permalink
fixed http res callbacks deallocationg
Browse files Browse the repository at this point in the history
  • Loading branch information
GenrikhFetischev committed Nov 24, 2023
1 parent 8fd9fda commit b431be6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "uwebsockets_rs"
version = "0.0.10"
version = "0.0.11"
edition = "2021"
authors = ["Genrikh Fetishchev <[email protected]>"]
description = "Rust wrapper for the uWebSockets"
Expand Down
9 changes: 7 additions & 2 deletions src/http_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ impl<const SSL: bool> HttpResponseStruct<SSL> {

pub fn deinit(&self) {
unsafe {
let _ = self.on_abort_ptr.map(|p| Box::from_raw(p));
let _ = self.on_writable_ptr.map(|p| Box::from_raw(p));
let _ = self.on_cork_ptr.map(|p| Box::from_raw(p));
}
Expand All @@ -157,7 +156,10 @@ impl<const SSL: bool> HttpResponseStruct<SSL> {
close_connection,
)
}
self.deinit()
self.deinit();
unsafe {
let _ = self.on_abort_ptr.map(|p| Box::from_raw(p));
}
}

pub fn try_end(
Expand All @@ -184,6 +186,9 @@ impl<const SSL: bool> HttpResponseStruct<SSL> {

if res.has_responded {
self.deinit();
unsafe {
let _ = self.on_abort_ptr.map(|p| Box::from_raw(p));
}
}

res
Expand Down

0 comments on commit b431be6

Please sign in to comment.