[PATCH] ole32: free *ppszProgID on error path (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Feb 16 10:46:04 CST 2013


Hi,

CID 713353

(actually unlikely as we queried this key just before ... but another
 process / thread might have deleted it.)

Ciao, Marcus
---
 dlls/ole32/compobj.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index dc2a02b..17bd7a1 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2033,8 +2033,11 @@ HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
       *ppszProgID = CoTaskMemAlloc(progidlen * sizeof(WCHAR));
       if (*ppszProgID)
       {
-        if (RegQueryValueW(hkey, NULL, *ppszProgID, &progidlen))
+        if (RegQueryValueW(hkey, NULL, *ppszProgID, &progidlen)) {
           ret = REGDB_E_CLASSNOTREG;
+          CoTaskMemFree(*ppszProgID);
+          *ppszProgID = NULL;
+        }
       }
       else
         ret = E_OUTOFMEMORY;
-- 
1.7.10.4




More information about the wine-patches mailing list