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

sxs: Use CRT memory allocation functions.

parent d3fe9faf
...@@ -88,12 +88,12 @@ static ULONG WINAPI name_Release( IAssemblyName *iface ) ...@@ -88,12 +88,12 @@ static ULONG WINAPI name_Release( IAssemblyName *iface )
if (!refs) if (!refs)
{ {
TRACE("destroying %p\n", name); TRACE("destroying %p\n", name);
HeapFree( GetProcessHeap(), 0, name->name ); free( name->name );
HeapFree( GetProcessHeap(), 0, name->arch ); free( name->arch );
HeapFree( GetProcessHeap(), 0, name->token ); free( name->token );
HeapFree( GetProcessHeap(), 0, name->type ); free( name->type );
HeapFree( GetProcessHeap(), 0, name->version ); free( name->version );
HeapFree( GetProcessHeap(), 0, name ); free( name );
} }
return refs; return refs;
} }
...@@ -251,9 +251,9 @@ static HRESULT WINAPI name_GetVersion( ...@@ -251,9 +251,9 @@ static HRESULT WINAPI name_GetVersion(
TRACE("%p, %p, %p\n", iface, high, low); TRACE("%p, %p, %p\n", iface, high, low);
if (!name->version) return HRESULT_FROM_WIN32( ERROR_NOT_FOUND ); if (!name->version) return HRESULT_FROM_WIN32( ERROR_NOT_FOUND );
if (!(version = strdupW( name->version ))) return E_OUTOFMEMORY; if (!(version = wcsdup( name->version ))) return E_OUTOFMEMORY;
hr = parse_version( version, high, low ); hr = parse_version( version, high, low );
HeapFree( GetProcessHeap(), 0, version ); free( version );
return hr; return hr;
} }
...@@ -300,7 +300,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int *len ) ...@@ -300,7 +300,7 @@ static WCHAR *parse_value( const WCHAR *str, unsigned int *len )
if (!*p) return NULL; if (!*p) return NULL;
*len = p - str; *len = p - str;
if (!(ret = HeapAlloc( GetProcessHeap(), 0, *len * sizeof(WCHAR) ))) return NULL; if (!(ret = malloc( *len * sizeof(WCHAR) ))) return NULL;
memcpy( ret, str + 1, (*len - 1) * sizeof(WCHAR) ); memcpy( ret, str + 1, (*len - 1) * sizeof(WCHAR) );
ret[*len - 1] = 0; ret[*len - 1] = 0;
return ret; return ret;
...@@ -314,7 +314,7 @@ static HRESULT parse_displayname( struct name *name, const WCHAR *displayname ) ...@@ -314,7 +314,7 @@ static HRESULT parse_displayname( struct name *name, const WCHAR *displayname )
p = q = displayname; p = q = displayname;
while (*q && *q != ',') q++; while (*q && *q != ',') q++;
len = q - p; len = q - p;
if (!(name->name = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) return E_OUTOFMEMORY; if (!(name->name = malloc( (len + 1) * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
memcpy( name->name, p, len * sizeof(WCHAR) ); memcpy( name->name, p, len * sizeof(WCHAR) );
name->name[len] = 0; name->name[len] = 0;
if (!*q) return S_OK; if (!*q) return S_OK;
...@@ -376,7 +376,7 @@ HRESULT WINAPI CreateAssemblyNameObject( ...@@ -376,7 +376,7 @@ HRESULT WINAPI CreateAssemblyNameObject(
if (!assembly || !assembly[0] || flags != CANOF_PARSE_DISPLAY_NAME) if (!assembly || !assembly[0] || flags != CANOF_PARSE_DISPLAY_NAME)
return E_INVALIDARG; return E_INVALIDARG;
if (!(name = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*name) ))) if (!(name = calloc(1, sizeof(*name) )))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
name->IAssemblyName_iface.lpVtbl = &name_vtbl; name->IAssemblyName_iface.lpVtbl = &name_vtbl;
...@@ -385,12 +385,12 @@ HRESULT WINAPI CreateAssemblyNameObject( ...@@ -385,12 +385,12 @@ HRESULT WINAPI CreateAssemblyNameObject(
hr = parse_displayname( name, assembly ); hr = parse_displayname( name, assembly );
if (hr != S_OK) if (hr != S_OK)
{ {
HeapFree( GetProcessHeap(), 0, name->name ); free( name->name );
HeapFree( GetProcessHeap(), 0, name->arch ); free( name->arch );
HeapFree( GetProcessHeap(), 0, name->token ); free( name->token );
HeapFree( GetProcessHeap(), 0, name->type ); free( name->type );
HeapFree( GetProcessHeap(), 0, name->version ); free( name->version );
HeapFree( GetProcessHeap(), 0, name ); free( name );
return hr; return hr;
} }
*obj = &name->IAssemblyName_iface; *obj = &name->IAssemblyName_iface;
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wine/heap.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(sxs); WINE_DEFAULT_DEBUG_CHANNEL(sxs);
...@@ -147,7 +147,7 @@ BOOL WINAPI SxsLookupClrGuid(DWORD flags, GUID *clsid, HANDLE actctx, void *buff ...@@ -147,7 +147,7 @@ BOOL WINAPI SxsLookupClrGuid(DWORD flags, GUID *clsid, HANDLE actctx, void *buff
goto out; goto out;
} }
assembly_info = heap_alloc(bytes_assembly_info); assembly_info = malloc(bytes_assembly_info);
if (!(retval = QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex, if (!(retval = QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex,
AssemblyDetailedInformationInActivationContext, assembly_info, AssemblyDetailedInformationInActivationContext, assembly_info,
bytes_assembly_info, &bytes_assembly_info))) bytes_assembly_info, &bytes_assembly_info)))
...@@ -219,6 +219,6 @@ out: ...@@ -219,6 +219,6 @@ out:
if (flags & SXS_LOOKUP_CLR_GUID_USE_ACTCTX) if (flags & SXS_LOOKUP_CLR_GUID_USE_ACTCTX)
DeactivateActCtx(0, cookie); DeactivateActCtx(0, cookie);
heap_free(assembly_info); free(assembly_info);
return retval; return retval;
} }
...@@ -26,13 +26,3 @@ enum name_attr_id ...@@ -26,13 +26,3 @@ enum name_attr_id
}; };
const WCHAR *get_name_attribute( IAssemblyName *, enum name_attr_id ) DECLSPEC_HIDDEN; const WCHAR *get_name_attribute( IAssemblyName *, enum name_attr_id ) DECLSPEC_HIDDEN;
static inline WCHAR *strdupW( const WCHAR *src )
{
WCHAR *dst;
if (!src) return NULL;
dst = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) );
if (dst) lstrcpyW( dst, src );
return dst;
}
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