Lionel_Debroux : mlang: Fix memory leaks in error paths (found by Smatch).
Alexandre Julliard
julliard at winehq.org
Thu Sep 27 09:27:31 CDT 2007
Module: wine
Branch: master
Commit: 333451411bd475aadf85daf821942f34460d6ae2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=333451411bd475aadf85daf821942f34460d6ae2
Author: Lionel_Debroux <Lionel_Debroux at pc-debroux>
Date: Wed Sep 26 14:25:26 2007 +0200
mlang: Fix memory leaks in error paths (found by Smatch).
---
dlls/mlang/mlang.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c
index 7a77df5..b6bd57e 100644
--- a/dlls/mlang/mlang.c
+++ b/dlls/mlang/mlang.c
@@ -1884,7 +1884,11 @@ static HRESULT EnumRfc1766_create(MLang_impl* mlang, LANGID LangId,
data.total = 0;
data.allocated = 32;
data.info = HeapAlloc(GetProcessHeap(), 0, data.allocated * sizeof(RFC1766INFO));
- if (!data.info) return S_FALSE;
+ if (!data.info)
+ {
+ HeapFree(GetProcessHeap(), 0, rfc);
+ return S_FALSE;
+ }
TlsSetValue(MLANG_tls_index, &data);
EnumSystemLocalesW(enum_locales_proc, 0/*LOCALE_SUPPORTED*/);
@@ -1892,7 +1896,12 @@ static HRESULT EnumRfc1766_create(MLang_impl* mlang, LANGID LangId,
TRACE("enumerated %d rfc1766 structures\n", data.total);
- if (!data.total) return FALSE;
+ if (!data.total)
+ {
+ HeapFree(GetProcessHeap(), 0, data.info);
+ HeapFree(GetProcessHeap(), 0, rfc);
+ return FALSE;
+ }
rfc->info = data.info;
rfc->total = data.total;
More information about the wine-cvs
mailing list