bindings: free the dlist handle wrapper in release_xfer_dlist_handle (#1829)
## What?
`nixl_capi_prep_xfer_dlist` (`src/bindings/rust/wrapper.cpp`) allocates
the handle
wrapper with `new nixl_capi_xfer_dlist_handle_s`, but
`nixl_capi_release_xfer_dlist_handle` only released the **inner** handle
and never
freed the wrapper:
```diff
try {
nixl_status_t ret = agent->inner->releasedDlistH(dlist_handle->handle);
+ delete dlist_handle;
return ret == NIXL_SUCCESS ? NIXL_CAPI_SUCCESS : NIXL_CAPI_ERROR_BACKEND;
}
```
## Why?
`releasedDlistH()` deletes the inner `nixlDlistH`; the
`nixl_capi_xfer_dlist_handle_s`
wrapper that `prep` `new`'d is a **separate** heap allocation that was
never freed, so
each prep/release cycle leaks one wrapper. Rust's
`XferDlistHandle::drop` calls release
exactly once and never retries, so an unconditional `delete` here is the
sole, correct
teardown (no double-free).
### Reproduction
Extracted LeakSanitizer reproducer of the `new wrapper` /
release-frees-only-inner
shape (`-fsanitize=address,leak`):
```
buggy: SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s)
fixed: no leak
```
## How (verification)
- Confirmed the before/after with the reproducer above.
- Compiled the modified `wrapper.cpp` **in-tree** with
`-Dsanitizer=address,undefined`
(exit 0).
## Related Issues
None.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Fixed a handle cleanup issue so released transfer handles are now
properly freed after use, helping prevent memory leaks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Signed-off-by: Eylon Krause <eylon1909@gmail.com> E
Eylon Eliyahu Krause committed
230100013c8d2d45b739316c6b8a67dfbb9e50fa
Parent: b8bbfdb
Committed by GitHub <noreply@github.com>
on 8/13/2026, 2:58:29 PM