From a18bc73fce4db51d5d56674ca1499b29274446dc Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 17 Dec 2009 18:45:53 -0600 Subject: [PATCH] shell32: Fix a memory leak in SHFileOperationW. --- dlls/shell32/shlfileop.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index b48e46ddab7..a768c15b9e4 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -1192,6 +1192,14 @@ static HRESULT copy_files(FILE_OPERATION *op, const FILE_LIST *flFrom, FILE_LIST if (flFrom->dwNumFiles != 1 && !IsAttribDir(fileDest->attributes)) return ERROR_CANCELLED; + /* Free all but the first entry. */ + for (i = 1; i < flTo->dwNumFiles; i++) + { + HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szDirectory); + HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFilename); + HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFullPath); + } + flTo->dwNumFiles = 1; } else if (IsAttribDir(fileDest->attributes))