Module: wine Branch: master Commit: afdd2191944337414f0e311adfaadfab615369ca URL: https://gitlab.winehq.org/wine/wine/-/commit/afdd2191944337414f0e311adfaadfa...
Author: Alex Henrie alexhenrie24@gmail.com Date: Sat Aug 26 20:07:34 2023 -0600
mpr: Fix double free in WNetGetResourceInformationA.
---
dlls/mpr/wnet.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c index 999a2a0e80c..e9c5321cee1 100644 --- a/dlls/mpr/wnet.c +++ b/dlls/mpr/wnet.c @@ -1684,7 +1684,7 @@ DWORD WINAPI WNetGetResourceInformationA( LPNETRESOURCEA lpNetResource, if (ret == WN_SUCCESS) { LPWSTR lpSystemW = NULL; - LPVOID lpBufferW; + NETRESOURCEW *lpBufferW; size = 1024; lpBufferW = HeapAlloc(GetProcessHeap(), 0, size); if (lpBufferW) @@ -1705,12 +1705,10 @@ DWORD WINAPI WNetGetResourceInformationA( LPNETRESOURCEA lpNetResource, { ret = _thunkNetResourceArrayWToA(lpBufferW, &count, lpBuffer, cbBuffer); - HeapFree(GetProcessHeap(), 0, lpNetResourceW); - lpNetResourceW = lpBufferW; size = sizeof(NETRESOURCEA); - size += WideCharToMultiByte(CP_ACP, 0, lpNetResourceW->lpRemoteName, + size += WideCharToMultiByte(CP_ACP, 0, lpBufferW->lpRemoteName, -1, NULL, 0, NULL, NULL); - size += WideCharToMultiByte(CP_ACP, 0, lpNetResourceW->lpProvider, + size += WideCharToMultiByte(CP_ACP, 0, lpBufferW->lpProvider, -1, NULL, 0, NULL, NULL);
len = WideCharToMultiByte(CP_ACP, 0, lpSystemW,