Nikolay Sivov : ole32: Don't try to read key value if key was not found ( Valgrind).
Alexandre Julliard
julliard at winehq.org
Mon May 30 09:43:41 CDT 2016
Module: wine
Branch: master
Commit: 4e5698f72e4d5ca6a774b746b77dde033bbb16d4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4e5698f72e4d5ca6a774b746b77dde033bbb16d4
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun May 29 19:22:32 2016 +0300
ole32: Don't try to read key value if key was not found (Valgrind).
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ole32/moniker.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/ole32/moniker.c b/dlls/ole32/moniker.c
index fee205c..2d6e8e8 100644
--- a/dlls/ole32/moniker.c
+++ b/dlls/ole32/moniker.c
@@ -1265,13 +1265,17 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
}
ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId);
-
- /* get the progId associated to the extension */
- progId = CoTaskMemAlloc(sizeProgId);
- ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId);
- if (!ret)
- /* return the clsid associated to the progId */
- res = CLSIDFromProgID(progId,pclsid);
+ if (!ret) {
+ /* get the progId associated to the extension */
+ progId = CoTaskMemAlloc(sizeProgId);
+ ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId);
+ if (!ret)
+ /* return the clsid associated to the progId */
+ res = CLSIDFromProgID(progId, pclsid);
+ else
+ res = HRESULT_FROM_WIN32(ret);
+ CoTaskMemFree(progId);
+ }
else
res = HRESULT_FROM_WIN32(ret);
@@ -1279,7 +1283,6 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
CoTaskMemFree(pathDec[i]);
CoTaskMemFree(pathDec);
- CoTaskMemFree(progId);
return res != S_OK ? MK_E_INVALIDEXTENSION : res;
}
More information about the wine-cvs
mailing list