-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Eliminate two memory leaks #16597
Eliminate two memory leaks #16597
Conversation
return winrt::to_hstring(returnVal); | ||
wil::unique_bstr returnVal; | ||
THROW_IF_FAILED(_uiaProvider->GetText(maxLength, returnVal.put())); | ||
return winrt::to_hstring(returnVal.get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could choose to use return winrt::hstring{ returnVal.get(), SysStringLen(returnVal.get()) }
here to avoid the need for the wcslen
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh! Thank you for doing this.
I'll mark this as approved but wait a little bit in case you want to do the wcslen thing.
In WindowsTerminal, there was a leak of a BSTR with every call to ITextRangeProvider::GetText, and a failure to call VariantClear in ITextRange::GetAttributeValue when the value stored in the variant is VT_BSTR. These were fixed by switching to wil::unique_bstr and wil::unique_variant.
301bb35
to
d2950aa
Compare
da99d89
into
microsoft:main
In WindowsTerminal, there was a leak of a BSTR with every call to ITextRangeProvider::GetText, and a failure to call VariantClear in ITextRange::GetAttributeValue when the value stored in the variant is VT_BSTR. These were fixed by switching to wil::unique_bstr and wil::unique_variant. (cherry picked from commit da99d89) Service-Card-Id: 91631735 Service-Version: 1.18
In WindowsTerminal, there was a leak of a BSTR with every call to ITextRangeProvider::GetText, and a failure to call VariantClear in ITextRange::GetAttributeValue when the value stored in the variant is VT_BSTR. These were fixed by switching to wil::unique_bstr and wil::unique_variant. (cherry picked from commit da99d89) Service-Card-Id: 91631736 Service-Version: 1.19
In WindowsTerminal, there was a leak of a BSTR with every call to
ITextRangeProvider::GetText, and a failure to call VariantClear in
ITextRange::GetAttributeValue when the value stored in the variant is
VT_BSTR. These were fixed by switching to wil::unique_bstr and
wil::unique_variant.