From d46862b4874519d70a4138285a6b754e3e0c4c20 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Fri, 30 Jan 2015 17:03:30 +0100 Subject: [PATCH] shell32: Handle TRASH_EnumItems failures correctly. --- dlls/shell32/recyclebin.c | 15 ++++++++++++--- dlls/shell32/tests/recyclebin.c | 21 +++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c index d839329c498..7053998106d 100644 --- a/dlls/shell32/recyclebin.c +++ b/dlls/shell32/recyclebin.c @@ -411,7 +411,7 @@ static HRESULT WINAPI RecycleBin_EnumObjects(IShellFolder2 *iface, HWND hwnd, SH IEnumIDListImpl *list; LPITEMIDLIST *pidls; HRESULT ret = E_OUTOFMEMORY; - int pidls_count; + int pidls_count = 0; int i=0; TRACE("(%p, %p, %x, %p)\n", This, hwnd, grfFlags, ppenumIDList); @@ -860,10 +860,14 @@ HRESULT WINAPI SHQueryRecycleBinW(LPCWSTR pszRootPath, LPSHQUERYRBINFO pSHQueryR LPITEMIDLIST *apidl; INT cidl; INT i=0; + HRESULT hr; + TRACE("(%s, %p)\n", debugstr_w(pszRootPath), pSHQueryRBInfo); FIXME("Ignoring pszRootPath=%s\n",debugstr_w(pszRootPath)); - TRASH_EnumItems(&apidl,&cidl); + hr = TRASH_EnumItems(&apidl,&cidl); + if (FAILED(hr)) + return hr; pSHQueryRBInfo->i64NumItems = cidl; pSHQueryRBInfo->i64Size = 0; for (; i