hnetcfg: Use CRT allocation functions.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-02-01 13:49:19 +03:00 committed by Alexandre Julliard
parent eb9da265d3
commit f20f988259
6 changed files with 31 additions and 33 deletions

View File

@ -29,7 +29,6 @@
#include "natupnp.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "hnetcfg_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg);
@ -62,7 +61,7 @@ static ULONG WINAPI fw_app_Release(
{
TRACE("destroying %p\n", fw_app);
SysFreeString( fw_app->filename );
HeapFree( GetProcessHeap(), 0, fw_app );
free( fw_app );
}
return refs;
}
@ -281,7 +280,7 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, NULL, &sz);
if (res == WN_MORE_DATA)
{
if (!(path = heap_alloc(sz)))
if (!(path = malloc(sz)))
return E_OUTOFMEMORY;
info = (UNIVERSAL_NAME_INFOW *)&path;
@ -291,21 +290,21 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
SysFreeString(This->filename);
This->filename = SysAllocString(info->lpUniversalName);
}
heap_free(path);
free(path);
return HRESULT_FROM_WIN32(res);
}
sz = GetFullPathNameW(image, 0, NULL, NULL);
if (!(path = heap_alloc(++sz * sizeof(WCHAR))))
if (!(path = malloc(++sz * sizeof(WCHAR))))
return E_OUTOFMEMORY;
GetFullPathNameW(image, sz, path, NULL);
longsz = GetLongPathNameW(path, path, sz);
if (longsz > sz)
{
if (!(path = heap_realloc(path, longsz * sizeof(WCHAR))))
if (!(path = realloc(path, longsz * sizeof(WCHAR))))
{
heap_free(path);
free(path);
return E_OUTOFMEMORY;
}
GetLongPathNameW(path, path, longsz);
@ -313,7 +312,7 @@ static HRESULT WINAPI fw_app_put_ProcessImageFileName(
SysFreeString( This->filename );
This->filename = SysAllocString(path);
heap_free(path);
free(path);
return This->filename ? S_OK : E_OUTOFMEMORY;
}
@ -432,7 +431,7 @@ HRESULT NetFwAuthorizedApplication_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
fa = malloc( sizeof(*fa) );
if (!fa) return E_OUTOFMEMORY;
fa->INetFwAuthorizedApplication_iface.lpVtbl = &fw_app_vtbl;
@ -470,7 +469,7 @@ static ULONG WINAPI fw_apps_Release(
if (!refs)
{
TRACE("destroying %p\n", fw_apps);
HeapFree( GetProcessHeap(), 0, fw_apps );
free( fw_apps );
}
return refs;
}
@ -645,7 +644,7 @@ HRESULT NetFwAuthorizedApplications_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
fa = malloc( sizeof(*fa) );
if (!fa) return E_OUTOFMEMORY;
fa->INetFwAuthorizedApplications_iface.lpVtbl = &fw_apps_vtbl;

View File

@ -58,7 +58,7 @@ static ULONG WINAPI fw_manager_Release(
if (!refs)
{
TRACE("destroying %p\n", fw_manager);
HeapFree( GetProcessHeap(), 0, fw_manager );
free( fw_manager );
}
return refs;
}
@ -244,7 +244,7 @@ HRESULT NetFwMgr_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fm = HeapAlloc( GetProcessHeap(), 0, sizeof(*fm) );
fm = malloc( sizeof(*fm) );
if (!fm) return E_OUTOFMEMORY;
fm->INetFwMgr_iface.lpVtbl = &fw_manager_vtbl;

View File

@ -105,7 +105,7 @@ static ULONG WINAPI netfw_rules_Release(
if (!refs)
{
TRACE("destroying %p\n", This);
HeapFree( GetProcessHeap(), 0, This );
free( This );
}
return refs;
}
@ -265,7 +265,7 @@ static HRESULT create_INetFwRules(INetFwRules **object)
TRACE("(%p)\n", object);
rules = HeapAlloc( GetProcessHeap(), 0, sizeof(*rules) );
rules = malloc( sizeof(*rules) );
if (!rules) return E_OUTOFMEMORY;
rules->INetFwRules_iface.lpVtbl = &fw_rules_vtbl;
@ -292,7 +292,7 @@ static ULONG WINAPI fw_policy_Release(
if (!refs)
{
TRACE("destroying %p\n", fw_policy);
HeapFree( GetProcessHeap(), 0, fw_policy );
free( fw_policy );
}
return refs;
}
@ -435,7 +435,7 @@ HRESULT NetFwPolicy_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
fp = malloc( sizeof(*fp) );
if (!fp) return E_OUTOFMEMORY;
fp->INetFwPolicy_iface.lpVtbl = &fw_policy_vtbl;
@ -487,7 +487,7 @@ static ULONG WINAPI fwpolicy2_Release(INetFwPolicy2 *iface)
{
INetFwRules_Release(fw_policy->fw_policy2_rules);
TRACE("destroying %p\n", fw_policy);
HeapFree( GetProcessHeap(), 0, fw_policy );
free( fw_policy );
}
return refs;
}
@ -768,7 +768,7 @@ HRESULT NetFwPolicy2_create( IUnknown *outer, void **obj )
TRACE("(%p,%p)\n", outer, obj);
fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
fp = malloc( sizeof(*fp) );
if (!fp) return E_OUTOFMEMORY;
fp->INetFwPolicy2_iface.lpVtbl = &fw_policy2_vtbl;
@ -778,7 +778,7 @@ HRESULT NetFwPolicy2_create( IUnknown *outer, void **obj )
if (FAILED(create_INetFwRules(&fp->fw_policy2_rules)))
{
HeapFree( GetProcessHeap(), 0, fp );
free( fp );
return E_OUTOFMEMORY;
}

View File

@ -28,7 +28,6 @@
#include "netfw.h"
#include "natupnp.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "hnetcfg_private.h"
@ -64,7 +63,7 @@ static ULONG WINAPI fw_port_Release(
{
TRACE("destroying %p\n", fw_port);
SysFreeString( fw_port->name );
HeapFree( GetProcessHeap(), 0, fw_port );
free( fw_port );
}
return refs;
}
@ -363,7 +362,7 @@ HRESULT NetFwOpenPort_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
fp = malloc( sizeof(*fp) );
if (!fp) return E_OUTOFMEMORY;
fp->INetFwOpenPort_iface.lpVtbl = &fw_port_vtbl;
@ -404,7 +403,7 @@ static ULONG WINAPI fw_ports_Release(
if (!refs)
{
TRACE("destroying %p\n", fw_ports);
HeapFree( GetProcessHeap(), 0, fw_ports );
free( fw_ports );
}
return refs;
}
@ -592,7 +591,7 @@ HRESULT NetFwOpenPorts_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
fp = malloc( sizeof(*fp) );
if (!fp) return E_OUTOFMEMORY;
fp->INetFwOpenPorts_iface.lpVtbl = &fw_ports_vtbl;
@ -653,7 +652,7 @@ static ULONG WINAPI upnpnat_Release(IUPnPNAT *iface)
LONG refs = InterlockedDecrement( &This->ref );
if (!refs)
{
heap_free( This );
free( This );
}
return refs;
}
@ -762,7 +761,7 @@ HRESULT IUPnPNAT_create(IUnknown *outer, void **object)
TRACE("(%p,%p)\n", outer, object);
nat = heap_alloc( sizeof(*nat) );
nat = malloc( sizeof(*nat) );
if (!nat) return E_OUTOFMEMORY;
nat->IUPnPNAT_iface.lpVtbl = &upnpnat_vtbl;

View File

@ -58,7 +58,7 @@ static ULONG WINAPI fw_profile_Release(
if (!refs)
{
TRACE("destroying %p\n", fw_profile);
HeapFree( GetProcessHeap(), 0, fw_profile );
free( fw_profile );
}
return refs;
}
@ -334,7 +334,7 @@ HRESULT NetFwProfile_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
fp = malloc( sizeof(*fp) );
if (!fp) return E_OUTOFMEMORY;
fp->INetFwProfile_iface.lpVtbl = &fw_profile_vtbl;

View File

@ -58,7 +58,7 @@ static ULONG WINAPI fw_service_Release(
if (!refs)
{
TRACE("destroying %p\n", fw_service);
HeapFree( GetProcessHeap(), 0, fw_service );
free( fw_service );
}
return refs;
}
@ -290,7 +290,7 @@ static HRESULT NetFwService_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
fp = malloc( sizeof(*fp) );
if (!fp) return E_OUTOFMEMORY;
fp->INetFwService_iface.lpVtbl = &fw_service_vtbl;
@ -328,7 +328,7 @@ static ULONG WINAPI fw_services_Release(
if (!refs)
{
TRACE("destroying %p\n", fw_services);
HeapFree( GetProcessHeap(), 0, fw_services );
free( fw_services );
}
return refs;
}
@ -464,7 +464,7 @@ HRESULT NetFwServices_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
fp = malloc( sizeof(*fp) );
if (!fp) return E_OUTOFMEMORY;
fp->INetFwServices_iface.lpVtbl = &fw_services_vtbl;