[WINESYNC] setupapi: Fix memory leak.

Found by Valgrind.

wine commit id 63231be8044441218fb82899e748900e1ace3d0d by Huw Davies <huw@codeweavers.com>

NOTE: Some of the code was already present as part of ReactOS-specific
changes. It has been slightly adapted to suit Wine changes.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
This commit is contained in:
winesync 2023-09-28 18:11:24 +02:00 committed by Hermès Bélusca-Maïto
parent 3a9df253a1
commit dda601fc43
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 7 additions and 6 deletions

View file

@ -775,7 +775,7 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
INFCONTEXT security_context;
#endif
INFCONTEXT context;
WCHAR dest[MAX_PATH], src[MAX_PATH];
WCHAR dest[MAX_PATH], src[MAX_PATH], *dest_dir;
INT flags;
BOOL ret;
@ -828,19 +828,20 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
if (!hlist) hlist = hinf;
if (!hinf) hinf = hlist;
if (!SetupFindFirstLineW( hlist, section, NULL, &context )) goto done;
if (!(params.TargetDirectory = get_destination_dir( hinf, section ))) goto done;
if (!(params.TargetDirectory = dest_dir = get_destination_dir( hinf, section ))) goto done;
do
{
if (!SetupGetStringFieldW( &context, 1, dest, sizeof(dest)/sizeof(WCHAR), NULL ))
goto done;
goto end;
if (!SetupGetStringFieldW( &context, 2, src, sizeof(src)/sizeof(WCHAR), NULL )) *src = 0;
if (!SetupGetIntField( &context, 4, &flags )) flags = 0; /* FIXME */
params.SourceFilename = *src ? src : NULL;
if (!SetupQueueCopyIndirectW( &params )) goto done;
if (!SetupQueueCopyIndirectW( &params )) goto end;
} while (SetupFindNextLine( &context, &context ));
ret = TRUE;
end:
HeapFree(GetProcessHeap(), 0, dest_dir);
done:
#ifdef __REACTOS__
if (security_descriptor)

View file

@ -3,4 +3,4 @@ files:
dlls/setupapi/queue.c: dll/win32/setupapi/queue.c
dlls/setupapi/stringtable.c: dll/win32/setupapi/stringtable.c
tags:
wine: ffae0123ac46ba6dfac74d7c84422073fd53b580
wine: 63231be8044441218fb82899e748900e1ace3d0d