xgamesave: InitializeProviderAsync leaks the Provider when XAsyncBegin refuses the block #218
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from avatarmanz/VIctory-7900XTX. Originally posted by kekonn on 2026-11-26T11:57:16Z.
crates/victory-hle/src/modules/xgamesave.rs:669:Provider::open(…).map(|p| xasync::bytes(give(p))), wheregiveisBox::into_raw. This puts a raw owning pointer into the result bytes ofxasync::finished_with.When
XAsyncBeginrefuses the call,finished_with's refused-begin path (xasync.rs ~828-832) frees only theBox<Result<Vec<u8>, HRESULT>>. A refusal happens for a null block, or a block that still holds an unfetched result. TheProviderthose bytes point at is never freed. This is the only result payload in the crate that is an owned heap handle.(A Provider the title never fetches also stays alive, but that follows the XAsync contract and is a one-off small allocation, so it is out of scope.)
Proposed fix (~6 lines)
In
initialize_async(~658-672), keep theResult<*mut Provider, HRESULT>. Passprovider.map(xasync::bytes)tofinished_with, and if it returns < 0,take(p)the provider.Upstream: no open PR touches
xgamesave.rsorxasync.rs.Status: a fix is being prepared in kekonn/VIctory-7900XTX on branch
claude/gifted-clarke-uxuqw8.Generated by Claude Code