fusion: Use HeapAlloc, not strdup, to avoid malloc/HeapFree mismatch.

This commit is contained in:
Dan Kegel 2008-05-26 19:19:11 -07:00 committed by Alexandre Julliard
parent b44df3a852
commit 713290ebce

View File

@ -406,7 +406,11 @@ HRESULT assembly_release(ASSEMBLY *assembly)
static LPSTR assembly_dup_str(ASSEMBLY *assembly, WORD index) 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) 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) HRESULT assembly_get_path(ASSEMBLY *assembly, LPSTR *path)
{ {
*path = strdup(assembly->path); LPSTR cpy = HeapAlloc(GetProcessHeap(), 0, strlen(assembly->path)+1);
if (!*path) *path = cpy;
if (cpy)
strcpy(cpy, assembly->path);
else
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
return S_OK; return S_OK;