Lionel_Debroux : mlang: Fix memory leaks in error path (found by Smatch).

Alexandre Julliard julliard at winehq.org
Thu Sep 27 09:27:31 CDT 2007


Module: wine
Branch: master
Commit: 8ae0d17d592c347a3ddd38bf4d97391716243e42
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8ae0d17d592c347a3ddd38bf4d97391716243e42

Author: Lionel_Debroux <Lionel_Debroux at pc-debroux>
Date:   Wed Sep 26 14:27:32 2007 +0200

mlang: Fix memory leaks in error path (found by Smatch).

---

 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 b5b8e0d..7a77df5 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;
     }




More information about the wine-cvs mailing list