[PATCH] shell32: Check error return in get_known_folder_path (Coverity)

Marcus Meissner marcus at jet.franken.de
Thu Jul 14 01:45:00 CDT 2011


Hi,

Coverity sees us checking return from  get_known_folder_registry_path
5 out of 6 times, so check it the 6th time too. Also check error return
from check get_known_folder_path.

CID 5202.

Ciao, Marcus
---
 dlls/shell32/shellpath.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 58e2006..4b14739 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -3422,9 +3422,14 @@ static HRESULT get_known_folder_path(
     if(hr == S_OK)
     {
         /* get parent's known folder path (recursive) */
-        get_known_folder_registry_path(NULL, parentGuid, &parentRegistryPath);
+        hr = get_known_folder_registry_path(NULL, parentGuid, &parentRegistryPath);
+        if(!SUCCEEDED(hr)) return hr;
 
         hr = get_known_folder_path(parentGuid, parentRegistryPath, &parentPath);
+        if(!SUCCEEDED(hr)) {
+            HeapFree(GetProcessHeap(), 0, parentRegistryPath);
+            return hr;
+        }
 
         lstrcatW(path, parentPath);
         lstrcatW(path, sBackslash);
-- 
1.7.3.4




More information about the wine-patches mailing list