Commit 5f0d53e2 authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

setupapi: Fix a path leak (Valgrind).

parent 448f4cc9
......@@ -1408,13 +1408,20 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
* actually isn't in a subdirectory, but keep track of what it
* was, and then later strip it from the root path that we
* ultimately resolve the source disk to. */
WCHAR *src_path = op->src_path;
WCHAR src_path[MAX_PATH];
size_t path_len = 0;
op->src_path = NULL;
if (src_path)
src_path[0] = 0;
if (op->src_path)
{
lstrcpyW(src_path, op->src_path);
path_len = lstrlenW(src_path);
lstrcatW(op->media->root, backslashW);
lstrcatW(op->media->root, src_path);
lstrcatW(op->media->root, op->src_path);
heap_free(op->src_path);
op->src_path = NULL;
}
for (;;)
......@@ -1450,12 +1457,11 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
if (queue_copy_file( paths.Source, paths.Target, op, handler, context ))
{
if (src_path && !op->media->cabinet)
if (path_len > 0 && !op->media->cabinet)
{
size_t root_len = lstrlenW(op->media->root), path_len = lstrlenW(src_path);
size_t root_len = lstrlenW(op->media->root);
if (path_len <= root_len && !wcsnicmp(op->media->root + root_len - path_len, src_path, path_len))
op->media->root[root_len - path_len - 1] = 0;
heap_free( src_path );
}
op->media->resolved = TRUE;
handler( context, SPFILENOTIFY_ENDCOPY, (UINT_PTR)&paths, 0 );
......
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