Module: wine Branch: master Commit: a18bc73fce4db51d5d56674ca1499b29274446dc URL: http://source.winehq.org/git/wine.git/?a=commit;h=a18bc73fce4db51d5d56674ca1...
Author: Vincent Povirk vincent@codeweavers.com Date: Thu Dec 17 18:45:53 2009 -0600
shell32: Fix a memory leak in SHFileOperationW.
---
dlls/shell32/shlfileop.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index b48e46d..a768c15 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))