Paul Gofman : hnetcfg: Use CRT allocation functions.

Alexandre Julliard julliard at winehq.org
Tue Feb 1 15:21:34 CST 2022


Module: wine
Branch: master
Commit: f20f98825922030364df3ae0ae9c52ac270964f2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f20f98825922030364df3ae0ae9c52ac270964f2

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Tue Feb  1 13:49:19 2022 +0300

hnetcfg: Use CRT allocation functions.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hnetcfg/apps.c    | 21 ++++++++++-----------
 dlls/hnetcfg/manager.c |  4 ++--
 dlls/hnetcfg/policy.c  | 14 +++++++-------
 dlls/hnetcfg/port.c    | 13 ++++++-------
 dlls/hnetcfg/profile.c |  4 ++--
 dlls/hnetcfg/service.c |  8 ++++----
 6 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index b6447cf4d63..16379e3457b 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -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;
diff --git a/dlls/hnetcfg/manager.c b/dlls/hnetcfg/manager.c
index 2c0790a73b5..fda69729901 100644
--- a/dlls/hnetcfg/manager.c
+++ b/dlls/hnetcfg/manager.c
@@ -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;
diff --git a/dlls/hnetcfg/policy.c b/dlls/hnetcfg/policy.c
index 1f5b0daa568..7bdc1563d90 100644
--- a/dlls/hnetcfg/policy.c
+++ b/dlls/hnetcfg/policy.c
@@ -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;
     }
 
diff --git a/dlls/hnetcfg/port.c b/dlls/hnetcfg/port.c
index fd4ac4977d3..9e9264df1dc 100644
--- a/dlls/hnetcfg/port.c
+++ b/dlls/hnetcfg/port.c
@@ -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;
diff --git a/dlls/hnetcfg/profile.c b/dlls/hnetcfg/profile.c
index d0e9f48dab4..63f6d0cc7ed 100644
--- a/dlls/hnetcfg/profile.c
+++ b/dlls/hnetcfg/profile.c
@@ -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;
diff --git a/dlls/hnetcfg/service.c b/dlls/hnetcfg/service.c
index 5bfeedaaedf..122d9797bab 100644
--- a/dlls/hnetcfg/service.c
+++ b/dlls/hnetcfg/service.c
@@ -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;




More information about the wine-cvs mailing list