[PATCH 0/1] MR8945: opcservices: IOpcPart::GetContentType takes LPWSTR, not BSTR.
And the WSTR it returns should be freed by CoTaskMemFree, as per [Microsoft's documentation](https://learn.microsoft.com/en-us/windows/win32/api/msopc/nf-msopc-iopcpart-...). Found by ASan. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8945
From: Yuxuan Shui <yshui(a)codeweavers.com> And the WSTR it returns should be freed by CoTaskMemFree, as per Microsoft's documentation. Found by ASan. --- dlls/opcservices/package.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/opcservices/package.c b/dlls/opcservices/package.c index 7b62224b846..b5a8537bb3d 100644 --- a/dlls/opcservices/package.c +++ b/dlls/opcservices/package.c @@ -1608,7 +1608,8 @@ static HRESULT opc_package_add_default_content_type(struct content_types *types, static HRESULT opc_package_add_content_type(struct content_types *types, IOpcPart *part) { struct content_type *cur; - BSTR ext, content_type; + BSTR ext; + WCHAR *content_type; BOOL added = FALSE; IOpcPartUri *name; HRESULT hr; @@ -1652,7 +1653,7 @@ static HRESULT opc_package_add_content_type(struct content_types *types, IOpcPar hr = opc_package_add_default_content_type(types, ext, content_type); SysFreeString(ext); - SysFreeString(content_type); + CoTaskMemFree(content_type); return hr; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8945
Unsure why this is showing up now since the code hasn't been changed for a long time. Probably these newly added tests (6aa8251075160ed79ee6b6e6371206c4fff6a038) uncovered it. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8945#note_115534
This merge request was approved by Nikolay Sivov. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8945
participants (3)
-
Nikolay Sivov (@nsivov) -
Yuxuan Shui -
Yuxuan Shui (@yshui)