Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: memory leak in owned lazyvalue #145

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "Apache-2.0"
name = "sonic-rs"
readme = "README.md"
repository = "https://github.com/cloudwego/sonic-rs"
version = "0.4.0-rc2"
version = "0.4.0-rc3"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 2 additions & 2 deletions src/lazyvalue/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ impl LazyRaw {
fn parse(&mut self) -> Result<Parsed> {
let ptr = self.parsed.get_mut();
if !(*ptr).is_null() {
let v = unsafe { std::ptr::read(*ptr) };
let v = unsafe { Box::from_raw(*ptr) };
*ptr = std::ptr::null_mut();
return Ok(v);
return Ok(*v);
}

let mut parser = crate::parser::Parser::new(crate::Read::from(&self.raw));
Expand Down
Loading