Module: wine Branch: master Commit: e130ef40a12cb3040a4b6c62f22c75ce2bdb0da8 URL: https://gitlab.winehq.org/wine/wine/-/commit/e130ef40a12cb3040a4b6c62f22c75c...
Author: Alex Henrie alexhenrie24@gmail.com Date: Sun Sep 24 12:26:44 2023 -0600
sc: Use CRT allocation functions.
---
programs/sc/sc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/programs/sc/sc.c b/programs/sc/sc.c index bd7e093b61d..d1954da1493 100644 --- a/programs/sc/sc.c +++ b/programs/sc/sc.c @@ -135,10 +135,9 @@ static BOOL parse_failure_actions( const WCHAR *arg, SERVICE_FAILURE_ACTIONSW *f unsigned int i, count; WCHAR *actions, *p;
- actions = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( arg ) + 1) * sizeof(WCHAR) ); + actions = wcsdup( arg ); if (!actions) return FALSE;
- lstrcpyW( actions, arg ); for (p = actions, count = 0; *p; p++) { if (*p == '/') @@ -150,10 +149,10 @@ static BOOL parse_failure_actions( const WCHAR *arg, SERVICE_FAILURE_ACTIONSW *f count = count / 2 + 1;
fa->cActions = count; - fa->lpsaActions = HeapAlloc( GetProcessHeap(), 0, fa->cActions * sizeof(SC_ACTION) ); + fa->lpsaActions = malloc( fa->cActions * sizeof(SC_ACTION) ); if (!fa->lpsaActions) { - HeapFree( GetProcessHeap(), 0, actions ); + free( actions ); return FALSE; }
@@ -170,7 +169,7 @@ static BOOL parse_failure_actions( const WCHAR *arg, SERVICE_FAILURE_ACTIONSW *f p += lstrlenW( p ) + 1; }
- HeapFree( GetProcessHeap(), 0, actions ); + free( actions ); return TRUE; }
@@ -333,7 +332,7 @@ int __cdecl wmain( int argc, const WCHAR *argv[] ) { ret = ChangeServiceConfig2W( service, SERVICE_CONFIG_FAILURE_ACTIONS, &sfa ); if (!ret) WINE_ERR("failed to set service failure actions %lu\n", GetLastError()); - HeapFree( GetProcessHeap(), 0, sfa.lpsaActions ); + free( sfa.lpsaActions ); } else WINE_ERR("failed to parse failure parameters\n");