fusion: Fix some memory leaks.

Hans Leidekker hans at codeweavers.com
Mon Dec 7 02:54:38 CST 2009


Found by Valgrind.
---
 dlls/fusion/asmname.c       |    5 +++++
 dlls/fusion/tests/asmenum.c |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/fusion/asmname.c b/dlls/fusion/asmname.c
index 913674a..3c014ea 100644
--- a/dlls/fusion/asmname.c
+++ b/dlls/fusion/asmname.c
@@ -471,6 +471,11 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
 
 done:
     HeapFree(GetProcessHeap(), 0, save);
+    if (FAILED(hr))
+    {
+        HeapFree(GetProcessHeap(), 0, name->displayname);
+        HeapFree(GetProcessHeap(), 0, name->name);
+    }
     return hr;
 }
 
diff --git a/dlls/fusion/tests/asmenum.c b/dlls/fusion/tests/asmenum.c
index 48f7b2a..cb6ea3d 100644
--- a/dlls/fusion/tests/asmenum.c
+++ b/dlls/fusion/tests/asmenum.c
@@ -209,6 +209,8 @@ static void test_CreateAssemblyEnum(void)
     ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
     ok(asmenum == (IAssemblyEnum *)0xdeadbeef,
        "Expected asmenum to be unchanged, got %p\n", asmenum);
+
+    IAssemblyName_Release(asmname);
 }
 
 typedef struct _tagASMNAME
-- 
1.6.3.3




More information about the wine-patches mailing list