msctf: fix memory leaks

Pierre Schweitzer pierre at reactos.org
Tue Dec 6 16:29:40 CST 2011


-------------- next part --------------
>From 3b446b8f1981711fdaaa95dcd651c672e5ae9f6f Mon Sep 17 00:00:00 2001
From: Pierre Schweitzer <pierre at reactos.org>
Date: Tue, 6 Dec 2011 21:53:20 +0100
Subject: Fix memory leaks

---
 dlls/msctf/context.c        |    3 +++
 dlls/msctf/inputprocessor.c |    6 ++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
index fbd7229..c013cf9 100644
--- a/dlls/msctf/context.c
+++ b/dlls/msctf/context.c
@@ -1013,7 +1013,10 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
 
     sinkcookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie));
     if (!sinkcookie)
+    {
+        HeapFree(GetProcessHeap(), 0, cookie);
         return E_OUTOFMEMORY;
+    }
 
     cookie->lockType = dwLockFlags;
     cookie->pOwningContext = This->pContext;
diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c
index 62b93c6..5242f14 100644
--- a/dlls/msctf/inputprocessor.c
+++ b/dlls/msctf/inputprocessor.c
@@ -924,7 +924,10 @@ static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut)
 
     if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
                     KEY_READ | KEY_WRITE, NULL, &This->key, NULL) != ERROR_SUCCESS)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
         return E_FAIL;
+    }
 
     TRACE("returning %p\n", This);
     *ppOut = (IEnumGUID*)This;
@@ -1161,7 +1164,10 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage
 
     if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
                     KEY_READ | KEY_WRITE, NULL, &This->tipkey, NULL) != ERROR_SUCCESS)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
         return E_FAIL;
+    }
 
     TRACE("returning %p\n", This);
     *ppOut = (IEnumTfLanguageProfiles*)This;
-- 
1.7.4.1



More information about the wine-patches mailing list