Fix memory leak in Android asset loading and optimize Windows IME loop#598
Open
KrishGoya1 wants to merge 1 commit intonot-fl3:masterfrom
Open
Fix memory leak in Android asset loading and optimize Windows IME loop#598KrishGoya1 wants to merge 1 commit intonot-fl3:masterfrom
KrishGoya1 wants to merge 1 commit intonot-fl3:masterfrom
Conversation
- Fix memory leak in Android asset loading by properly freeing malloc'd buffers - Optimize needless range loop in Windows IME composition string handling - Reduce Clippy warnings from 4 to 3
not-fl3
reviewed
Jan 6, 2026
| (*out).content_length = length as _; | ||
| (*out).content = buffer as _; | ||
| } else { | ||
| libc::free(buffer); |
Owner
There was a problem hiding this comment.
Isn't it a use after free situation? buffer is being returned and than freed right away?
not-fl3
reviewed
Jan 6, 2026
| let slice = | ||
| unsafe { std::slice::from_raw_parts(data.content, data.content_length as _) }; | ||
| let response = slice.iter().map(|c| *c as _).collect::<Vec<_>>(); | ||
| unsafe { libc::free(data.content as *mut std::ffi::c_void); }; |
Owner
There was a problem hiding this comment.
It looks like the same problem here, isn't response a slice into data.content?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary :
fixes memory leak in android asset loading
-> in
src/native/android.rsandsrc/fs.rsby freeing malloc buffers after loading assets to prevent memory leak crashes in Android appsOptimizes windows IME loop
-> in
src/native/windows.rsreplaced range loop with idiomatic iteration.Testing :
code compiles successfully with
cargo check