Commit d3fe9faf authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

fusion: Use CRT memory allocation functions.

parent a4061238
...@@ -62,7 +62,7 @@ static BOOL create_full_path(LPCWSTR path) ...@@ -62,7 +62,7 @@ static BOOL create_full_path(LPCWSTR path)
BOOL ret = TRUE; BOOL ret = TRUE;
int len; int len;
if (!(new_path = heap_alloc((lstrlenW(path) + 1) * sizeof(WCHAR)))) return FALSE; if (!(new_path = malloc((lstrlenW(path) + 1) * sizeof(WCHAR)))) return FALSE;
lstrcpyW(new_path, path); lstrcpyW(new_path, path);
...@@ -100,7 +100,7 @@ static BOOL create_full_path(LPCWSTR path) ...@@ -100,7 +100,7 @@ static BOOL create_full_path(LPCWSTR path)
new_path[len] = '\\'; new_path[len] = '\\';
} }
heap_free(new_path); free(new_path);
return ret; return ret;
} }
...@@ -197,7 +197,7 @@ static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface) ...@@ -197,7 +197,7 @@ static ULONG WINAPI IAssemblyCacheImpl_Release(IAssemblyCache *iface)
if (!refCount) if (!refCount)
{ {
CloseHandle( cache->lock ); CloseHandle( cache->lock );
heap_free( cache ); free( cache );
} }
return refCount; return refCount;
} }
...@@ -255,7 +255,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface ...@@ -255,7 +255,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_UninstallAssembly(IAssemblyCache *iface
if (hr != HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER )) if (hr != HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER ))
goto done; goto done;
if (!(path = heap_alloc( len * sizeof(WCHAR) ))) if (!(path = malloc( len * sizeof(WCHAR) )))
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto done; goto done;
...@@ -290,7 +290,7 @@ done: ...@@ -290,7 +290,7 @@ done:
IAssemblyName_Release( asmname ); IAssemblyName_Release( asmname );
if (next) IAssemblyName_Release( next ); if (next) IAssemblyName_Release( next );
if (asmenum) IAssemblyEnum_Release( asmenum ); if (asmenum) IAssemblyEnum_Release( asmenum );
heap_free( path ); free( path );
cache_unlock( cache ); cache_unlock( cache );
return hr; return hr;
} }
...@@ -372,7 +372,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyCacheItem(IAssemblyCache ...@@ -372,7 +372,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyCacheItem(IAssemblyCache
*ppAsmItem = NULL; *ppAsmItem = NULL;
if (!(item = heap_alloc(sizeof(*item)))) return E_OUTOFMEMORY; if (!(item = malloc(sizeof(*item)))) return E_OUTOFMEMORY;
item->IAssemblyCacheItem_iface.lpVtbl = &AssemblyCacheItemVtbl; item->IAssemblyCacheItem_iface.lpVtbl = &AssemblyCacheItemVtbl;
item->ref = 1; item->ref = 1;
...@@ -395,22 +395,22 @@ static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_ ...@@ -395,22 +395,22 @@ static HRESULT copy_file( const WCHAR *src_dir, DWORD src_len, const WCHAR *dst_
DWORD len = lstrlenW( filename ); DWORD len = lstrlenW( filename );
HRESULT hr = S_OK; HRESULT hr = S_OK;
if (!(src_file = heap_alloc( (src_len + len + 1) * sizeof(WCHAR) ))) if (!(src_file = malloc( (src_len + len + 1) * sizeof(WCHAR) )))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy( src_file, src_dir, src_len * sizeof(WCHAR) ); memcpy( src_file, src_dir, src_len * sizeof(WCHAR) );
lstrcpyW( src_file + src_len, filename ); lstrcpyW( src_file + src_len, filename );
if (!(dst_file = heap_alloc( (dst_len + len + 1) * sizeof(WCHAR) ))) if (!(dst_file = malloc( (dst_len + len + 1) * sizeof(WCHAR) )))
{ {
heap_free( src_file ); free( src_file );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
memcpy( dst_file, dst_dir, dst_len * sizeof(WCHAR) ); memcpy( dst_file, dst_dir, dst_len * sizeof(WCHAR) );
lstrcpyW( dst_file + dst_len, filename ); lstrcpyW( dst_file + dst_len, filename );
if (!CopyFileW( src_file, dst_file, FALSE )) hr = HRESULT_FROM_WIN32( GetLastError() ); if (!CopyFileW( src_file, dst_file, FALSE )) hr = HRESULT_FROM_WIN32( GetLastError() );
heap_free( src_file ); free( src_file );
heap_free( dst_file ); free( dst_file );
return hr; return hr;
} }
...@@ -483,7 +483,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, ...@@ -483,7 +483,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
get_assembly_directory(asmdir, MAX_PATH, clr_version, architecture); get_assembly_directory(asmdir, MAX_PATH, clr_version, architecture);
dst_len += lstrlenW(asmdir) + lstrlenW(name) + lstrlenW(version) + lstrlenW(token); dst_len += lstrlenW(asmdir) + lstrlenW(name) + lstrlenW(version) + lstrlenW(token);
if (!(dst_dir = heap_alloc(dst_len * sizeof(WCHAR)))) if (!(dst_dir = malloc(dst_len * sizeof(WCHAR))))
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto done; goto done;
...@@ -523,13 +523,13 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface, ...@@ -523,13 +523,13 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
} }
done: done:
heap_free(name); free(name);
heap_free(token); free(token);
heap_free(version); free(version);
heap_free(asmpath); free(asmpath);
heap_free(dst_dir); free(dst_dir);
for (i = 0; i < count; i++) heap_free(external_files[i]); for (i = 0; i < count; i++) free(external_files[i]);
heap_free(external_files); free(external_files);
assembly_release(assembly); assembly_release(assembly);
cache_unlock( cache ); cache_unlock( cache );
return hr; return hr;
...@@ -560,14 +560,14 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved ...@@ -560,14 +560,14 @@ HRESULT WINAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved
*ppAsmCache = NULL; *ppAsmCache = NULL;
if (!(cache = heap_alloc(sizeof(*cache)))) return E_OUTOFMEMORY; if (!(cache = malloc(sizeof(*cache)))) return E_OUTOFMEMORY;
cache->IAssemblyCache_iface.lpVtbl = &AssemblyCacheVtbl; cache->IAssemblyCache_iface.lpVtbl = &AssemblyCacheVtbl;
cache->ref = 1; cache->ref = 1;
cache->lock = CreateMutexW( NULL, FALSE, cache_mutex_nameW ); cache->lock = CreateMutexW( NULL, FALSE, cache_mutex_nameW );
if (!cache->lock) if (!cache->lock)
{ {
heap_free( cache ); free( cache );
return HRESULT_FROM_WIN32( GetLastError() ); return HRESULT_FROM_WIN32( GetLastError() );
} }
*ppAsmCache = &cache->IAssemblyCache_iface; *ppAsmCache = &cache->IAssemblyCache_iface;
...@@ -620,7 +620,7 @@ static ULONG WINAPI IAssemblyCacheItemImpl_Release(IAssemblyCacheItem *iface) ...@@ -620,7 +620,7 @@ static ULONG WINAPI IAssemblyCacheItemImpl_Release(IAssemblyCacheItem *iface)
TRACE("(%p)->(ref before = %lu)\n", This, refCount + 1); TRACE("(%p)->(ref before = %lu)\n", This, refCount + 1);
if (!refCount) if (!refCount)
heap_free(This); free(This);
return refCount; return refCount;
} }
......
...@@ -105,10 +105,10 @@ static ULONG WINAPI IAssemblyEnumImpl_Release(IAssemblyEnum *iface) ...@@ -105,10 +105,10 @@ static ULONG WINAPI IAssemblyEnumImpl_Release(IAssemblyEnum *iface)
list_remove(&asmname->entry); list_remove(&asmname->entry);
IAssemblyName_Release(asmname->name); IAssemblyName_Release(asmname->name);
heap_free(asmname); free(asmname);
} }
heap_free(This); free(This);
} }
return refCount; return refCount;
...@@ -354,7 +354,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, ...@@ -354,7 +354,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
} }
swprintf(disp, ARRAY_SIZE(disp), name_fmt, parent, version, token); swprintf(disp, ARRAY_SIZE(disp), name_fmt, parent, version, token);
if (!(asmname = heap_alloc(sizeof(*asmname)))) if (!(asmname = malloc(sizeof(*asmname))))
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
break; break;
...@@ -364,7 +364,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, ...@@ -364,7 +364,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
CANOF_PARSE_DISPLAY_NAME, NULL); CANOF_PARSE_DISPLAY_NAME, NULL);
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(asmname); free(asmname);
break; break;
} }
...@@ -372,7 +372,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name, ...@@ -372,7 +372,7 @@ static HRESULT enum_gac_assemblies(struct list *assemblies, IAssemblyName *name,
if (FAILED(hr)) if (FAILED(hr))
{ {
IAssemblyName_Release(asmname->name); IAssemblyName_Release(asmname->name);
heap_free(asmname); free(asmname);
break; break;
} }
...@@ -475,7 +475,7 @@ HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, ...@@ -475,7 +475,7 @@ HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved,
if (dwFlags == 0 || dwFlags == ASM_CACHE_ROOT) if (dwFlags == 0 || dwFlags == ASM_CACHE_ROOT)
return E_INVALIDARG; return E_INVALIDARG;
if (!(asmenum = heap_alloc(sizeof(*asmenum)))) return E_OUTOFMEMORY; if (!(asmenum = malloc(sizeof(*asmenum)))) return E_OUTOFMEMORY;
asmenum->IAssemblyEnum_iface.lpVtbl = &AssemblyEnumVtbl; asmenum->IAssemblyEnum_iface.lpVtbl = &AssemblyEnumVtbl;
asmenum->ref = 1; asmenum->ref = 1;
...@@ -486,7 +486,7 @@ HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, ...@@ -486,7 +486,7 @@ HRESULT WINAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved,
hr = enumerate_gac(asmenum, pName); hr = enumerate_gac(asmenum, pName);
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(asmenum); free(asmenum);
return hr; return hr;
} }
} }
......
...@@ -114,12 +114,12 @@ static ULONG WINAPI IAssemblyNameImpl_Release(IAssemblyName *iface) ...@@ -114,12 +114,12 @@ static ULONG WINAPI IAssemblyNameImpl_Release(IAssemblyName *iface)
if (!refCount) if (!refCount)
{ {
heap_free(This->path); free(This->path);
heap_free(This->displayname); free(This->displayname);
heap_free(This->name); free(This->name);
heap_free(This->culture); free(This->culture);
heap_free(This->procarch); free(This->procarch);
heap_free(This); free(This);
} }
return refCount; return refCount;
...@@ -521,7 +521,7 @@ HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path) ...@@ -521,7 +521,7 @@ HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path)
{ {
IAssemblyNameImpl *name = unsafe_impl_from_IAssemblyName(iface); IAssemblyNameImpl *name = unsafe_impl_from_IAssemblyName(iface);
name->path = strdupW(path); name->path = wcsdup(path);
if (!name->path) if (!name->path)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -576,12 +576,10 @@ static HRESULT parse_version(IAssemblyNameImpl *name, LPWSTR version) ...@@ -576,12 +576,10 @@ static HRESULT parse_version(IAssemblyNameImpl *name, LPWSTR version)
static HRESULT parse_culture(IAssemblyNameImpl *name, LPCWSTR culture) static HRESULT parse_culture(IAssemblyNameImpl *name, LPCWSTR culture)
{ {
static const WCHAR empty[] = {0};
if (lstrlenW(culture) == 2) if (lstrlenW(culture) == 2)
name->culture = strdupW(culture); name->culture = wcsdup(culture);
else else
name->culture = strdupW(empty); name->culture = wcsdup(L"");
return S_OK; return S_OK;
} }
...@@ -662,7 +660,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int len ) ...@@ -662,7 +660,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int len )
BOOL quoted = FALSE; BOOL quoted = FALSE;
unsigned int i = 0; unsigned int i = 0;
if (!(ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL; if (!(ret = malloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
if (*p == '\"') if (*p == '\"')
{ {
quoted = TRUE; quoted = TRUE;
...@@ -671,7 +669,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int len ) ...@@ -671,7 +669,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int len )
while (*p && *p != '\"') ret[i++] = *p++; while (*p && *p != '\"') ret[i++] = *p++;
if ((quoted && *p != '\"') || (!quoted && *p == '\"')) if ((quoted && *p != '\"') || (!quoted && *p == '\"'))
{ {
heap_free( ret ); free( ret );
return NULL; return NULL;
} }
ret[i] = 0; ret[i] = 0;
...@@ -687,11 +685,11 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam ...@@ -687,11 +685,11 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
if (!szAssemblyName) if (!szAssemblyName)
return S_OK; return S_OK;
name->displayname = strdupW(szAssemblyName); name->displayname = wcsdup(szAssemblyName);
if (!name->displayname) if (!name->displayname)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
str = strdupW(szAssemblyName); str = wcsdup(szAssemblyName);
save = str; save = str;
if (!str) if (!str)
{ {
...@@ -709,7 +707,7 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam ...@@ -709,7 +707,7 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
goto done; goto done;
} }
name->name = strdupW(str); name->name = wcsdup(str);
if (!name->name) if (!name->name)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -768,7 +766,7 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam ...@@ -768,7 +766,7 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
hr = parse_procarch( name, name->procarch ); hr = parse_procarch( name, name->procarch );
} }
heap_free( value ); free( value );
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
...@@ -777,13 +775,13 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam ...@@ -777,13 +775,13 @@ static HRESULT parse_display_name(IAssemblyNameImpl *name, LPCWSTR szAssemblyNam
} }
done: done:
heap_free(save); free(save);
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(name->displayname); free(name->displayname);
heap_free(name->name); free(name->name);
heap_free(name->culture); free(name->culture);
heap_free(name->procarch); free(name->procarch);
} }
return hr; return hr;
} }
...@@ -808,7 +806,7 @@ HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj, ...@@ -808,7 +806,7 @@ HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj,
(!szAssemblyName || !*szAssemblyName)) (!szAssemblyName || !*szAssemblyName))
return E_INVALIDARG; return E_INVALIDARG;
if (!(name = heap_alloc_zero(sizeof(*name)))) return E_OUTOFMEMORY; if (!(name = calloc(1, sizeof(*name)))) return E_OUTOFMEMORY;
name->IAssemblyName_iface.lpVtbl = &AssemblyNameVtbl; name->IAssemblyName_iface.lpVtbl = &AssemblyNameVtbl;
name->ref = 1; name->ref = 1;
...@@ -816,7 +814,7 @@ HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj, ...@@ -816,7 +814,7 @@ HRESULT WINAPI CreateAssemblyNameObject(IAssemblyName **ppAssemblyNameObj,
hr = parse_display_name(name, szAssemblyName); hr = parse_display_name(name, szAssemblyName);
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(name); free(name);
return hr; return hr;
} }
......
...@@ -540,7 +540,7 @@ static HRESULT parse_metadata_header(ASSEMBLY *assembly, DWORD *hdrsz) ...@@ -540,7 +540,7 @@ static HRESULT parse_metadata_header(ASSEMBLY *assembly, DWORD *hdrsz)
metadatahdr = (METADATAHDR *)ptr; metadatahdr = (METADATAHDR *)ptr;
if (!(assembly->metadatahdr = heap_alloc(sizeof(*assembly->metadatahdr)))) return E_OUTOFMEMORY; if (!(assembly->metadatahdr = malloc(sizeof(*assembly->metadatahdr)))) return E_OUTOFMEMORY;
size = FIELD_OFFSET(METADATAHDR, Version); size = FIELD_OFFSET(METADATAHDR, Version);
memcpy(assembly->metadatahdr, metadatahdr, size); memcpy(assembly->metadatahdr, metadatahdr, size);
...@@ -645,9 +645,9 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file) ...@@ -645,9 +645,9 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
*out = NULL; *out = NULL;
if (!(assembly = heap_alloc_zero(sizeof(*assembly)))) return E_OUTOFMEMORY; if (!(assembly = calloc(1, sizeof(*assembly)))) return E_OUTOFMEMORY;
assembly->path = strdupW(file); assembly->path = wcsdup(file);
if (!assembly->path) if (!assembly->path)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -696,12 +696,12 @@ HRESULT assembly_release(ASSEMBLY *assembly) ...@@ -696,12 +696,12 @@ HRESULT assembly_release(ASSEMBLY *assembly)
if (!assembly) if (!assembly)
return S_OK; return S_OK;
heap_free(assembly->metadatahdr); free(assembly->metadatahdr);
heap_free(assembly->path); free(assembly->path);
UnmapViewOfFile(assembly->data); UnmapViewOfFile(assembly->data);
CloseHandle(assembly->hmap); CloseHandle(assembly->hmap);
CloseHandle(assembly->hfile); CloseHandle(assembly->hfile);
heap_free(assembly); free(assembly);
return S_OK; return S_OK;
} }
...@@ -714,7 +714,7 @@ static LPWSTR assembly_dup_str(const ASSEMBLY *assembly, DWORD index) ...@@ -714,7 +714,7 @@ static LPWSTR assembly_dup_str(const ASSEMBLY *assembly, DWORD index)
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
if ((cpy = heap_alloc(len * sizeof(WCHAR)))) if ((cpy = malloc(len * sizeof(WCHAR))))
MultiByteToWideChar(CP_ACP, 0, str, -1, cpy, len); MultiByteToWideChar(CP_ACP, 0, str, -1, cpy, len);
return cpy; return cpy;
...@@ -749,7 +749,7 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name) ...@@ -749,7 +749,7 @@ HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name)
HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path) HRESULT assembly_get_path(const ASSEMBLY *assembly, LPWSTR *path)
{ {
WCHAR *cpy = heap_alloc((lstrlenW(assembly->path) + 1) * sizeof(WCHAR)); WCHAR *cpy = malloc((lstrlenW(assembly->path) + 1) * sizeof(WCHAR));
*path = cpy; *path = cpy;
if (cpy) if (cpy)
lstrcpyW(cpy, assembly->path); lstrcpyW(cpy, assembly->path);
...@@ -776,7 +776,7 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version) ...@@ -776,7 +776,7 @@ HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version)
if (!asmtbl) if (!asmtbl)
return E_FAIL; return E_FAIL;
if (!(*version = heap_alloc(24 * sizeof(WCHAR)))) if (!(*version = malloc(24 * sizeof(WCHAR))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
swprintf(*version, 24, format, asmtbl->MajorVersion, asmtbl->MinorVersion, swprintf(*version, 24, format, asmtbl->MajorVersion, asmtbl->MinorVersion,
...@@ -846,7 +846,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token) ...@@ -846,7 +846,7 @@ HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token)
for (i = size - 1; i >= size - 8; i--) for (i = size - 1; i >= size - 8; i--)
tokbytes[size - i - 1] = hashdata[i]; tokbytes[size - i - 1] = hashdata[i];
if (!(tok = heap_alloc((TOKEN_LENGTH + 1) * sizeof(WCHAR)))) if (!(tok = malloc((TOKEN_LENGTH + 1) * sizeof(WCHAR))))
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto done; goto done;
...@@ -890,7 +890,7 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c ...@@ -890,7 +890,7 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c
if (num_rows <= 0) if (num_rows <= 0)
return S_OK; return S_OK;
if (!(ret = heap_alloc(num_rows * sizeof(WCHAR *)))) return E_OUTOFMEMORY; if (!(ret = malloc(num_rows * sizeof(WCHAR *)))) return E_OUTOFMEMORY;
for (i = 0; i < num_rows; i++) for (i = 0; i < num_rows; i++)
{ {
...@@ -903,8 +903,8 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c ...@@ -903,8 +903,8 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c
ret[i] = assembly_dup_str(assembly, idx); ret[i] = assembly_dup_str(assembly, idx);
if (!ret[i]) if (!ret[i])
{ {
for (; i >= 0; i--) heap_free(ret[i]); for (; i >= 0; i--) free(ret[i]);
heap_free(ret); free(ret);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
ptr += assembly->stringsz; /* skip Name field */ ptr += assembly->stringsz; /* skip Name field */
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
#include "winver.h" #include "winver.h"
#include "wine/heap.h"
#include <pshpack1.h> #include <pshpack1.h>
...@@ -442,19 +441,6 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c ...@@ -442,19 +441,6 @@ HRESULT assembly_get_external_files(ASSEMBLY *assembly, LPWSTR **files, DWORD *c
extern HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path) DECLSPEC_HIDDEN; extern HRESULT IAssemblyName_SetPath(IAssemblyName *iface, LPCWSTR path) DECLSPEC_HIDDEN;
extern HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len) DECLSPEC_HIDDEN; extern HRESULT IAssemblyName_GetPath(IAssemblyName *iface, LPWSTR buf, ULONG *len) DECLSPEC_HIDDEN;
static inline LPWSTR strdupW(LPCWSTR src)
{
LPWSTR dest;
if (!src)
return NULL;
if ((dest = heap_alloc((lstrlenW(src) + 1) * sizeof(WCHAR))))
lstrcpyW(dest, src);
return dest;
}
#define BYTES_PER_TOKEN 8 #define BYTES_PER_TOKEN 8
#define CHARS_PER_BYTE 2 #define CHARS_PER_BYTE 2
#define TOKEN_LENGTH (BYTES_PER_TOKEN * CHARS_PER_BYTE + 1) #define TOKEN_LENGTH (BYTES_PER_TOKEN * CHARS_PER_BYTE + 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment