Dan Kegel : fusion: Use HeapAlloc, not strdup, to avoid malloc/ HeapFree mismatch.
Alexandre Julliard
julliard at winehq.org
Wed May 28 04:56:53 CDT 2008
Module: wine
Branch: master
Commit: 713290ebcea57bc5f2a0b7c1a7e237a225e8fdcb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=713290ebcea57bc5f2a0b7c1a7e237a225e8fdcb
Author: Dan Kegel <dank at kegel.com>
Date: Mon May 26 19:19:11 2008 -0700
fusion: Use HeapAlloc, not strdup, to avoid malloc/HeapFree mismatch.
---
dlls/fusion/assembly.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/fusion/assembly.c b/dlls/fusion/assembly.c
index 8973af3..94ea542 100644
--- a/dlls/fusion/assembly.c
+++ b/dlls/fusion/assembly.c
@@ -406,7 +406,11 @@ HRESULT assembly_release(ASSEMBLY *assembly)
static LPSTR assembly_dup_str(ASSEMBLY *assembly, WORD index)
{
- return strdup((LPSTR)&assembly->strings[index]);
+ LPSTR str = (LPSTR)&assembly->strings[index];
+ LPSTR cpy = HeapAlloc(GetProcessHeap(), 0, strlen(str)+1);
+ if (cpy)
+ strcpy(cpy, str);
+ return cpy;
}
HRESULT assembly_get_name(ASSEMBLY *assembly, LPSTR *name)
@@ -431,8 +435,11 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPSTR *name)
HRESULT assembly_get_path(ASSEMBLY *assembly, LPSTR *path)
{
- *path = strdup(assembly->path);
- if (!*path)
+ LPSTR cpy = HeapAlloc(GetProcessHeap(), 0, strlen(assembly->path)+1);
+ *path = cpy;
+ if (cpy)
+ strcpy(cpy, assembly->path);
+ else
return E_OUTOFMEMORY;
return S_OK;
More information about the wine-cvs
mailing list