Skip to content

Release the type library reference returned when importing a library type or object - #8636

Merged
bdash merged 1 commit into
devfrom
test_typelib_import_ref_leak
Oct 10, 2026
Merged

bdash merged 1 commit into
devfrom
test_typelib_import_ref_leak

Conversation

@bdash

@bdash bdash commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

BNBinaryViewImportTypeLibraryType and
BNBinaryViewImportTypeLibraryObject store a new reference to the library the type or object came from in their lib out-parameter. The Python and Rust wrappers never released it, so every import leaked a reference to a type library. The Python wrappers also pointed the out-parameter at the caller's own handle, which let core write into the caller's TypeLibrary.

Now both bindings pass a separate out-parameter and release what core returns. The C++ API already handled this correctly.

…type or object

`BNBinaryViewImportTypeLibraryType` and
`BNBinaryViewImportTypeLibraryObject` store a new reference to the
library the type or object came from in their `lib` out-parameter. The
Python and Rust wrappers never released it, so every import leaked a
reference to a type library. The Python wrappers also pointed the
out-parameter at the caller's own handle, which let core write into the
caller's `TypeLibrary`.

Now both bindings pass a separate out-parameter and release what core
returns. The C++ API already handled this correctly.

@fuzyll fuzyll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. This looks good to me. Thanks!

@bdash
bdash force-pushed the test_typelib_import_ref_leak branch from a6a77b2 to 38eac6c Compare October 10, 2026 00:50
@bdash
bdash merged commit 38eac6c into dev Oct 10, 2026
9 of 10 checks passed
@bdash
bdash deleted the test_typelib_import_ref_leak branch October 10, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants