mlang: fix memory leak in error path (found by Smatch).

Lionel_Debroux (none) Lionel_Debroux at pc-debroux.
Wed Sep 26 07:27:32 CDT 2007


---
 dlls/mlang/mlang.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c
index b557ec4..b6bd57e 100644
--- a/dlls/mlang/mlang.c
+++ b/dlls/mlang/mlang.c
@@ -634,10 +634,9 @@ HRESULT WINAPI ConvertINetString(
 
         pDstStrW = HeapAlloc(GetProcessHeap(), 0, cDstSizeW * sizeof(WCHAR));
         hr = ConvertINetMultiByteToUnicode(pdwMode, dwSrcEncoding, pSrcStr, pcSrcSize, pDstStrW, &cDstSizeW);
-        if (hr != S_OK)
-            return hr;
+        if (hr == S_OK)
+            hr = ConvertINetUnicodeToMultiByte(pdwMode, dwDstEncoding, pDstStrW, &cDstSizeW, pDstStr, pcDstSize);
 
-        hr = ConvertINetUnicodeToMultiByte(pdwMode, dwDstEncoding, pDstStrW, &cDstSizeW, pDstStr, pcDstSize);
         HeapFree(GetProcessHeap(), 0, pDstStrW);
         return hr;
     }
-- 
1.5.3.1


--------------020602000207090403070205--



More information about the wine-patches mailing list