Skip to content

Commit

Permalink
ole32: Fix some leaks on early returns (Coverity).
Browse files Browse the repository at this point in the history
  • Loading branch information
nsivov authored and julliard committed Mar 25, 2014
1 parent 9d1232a commit 43b5f46
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dlls/ole32/moniker.c
Expand Up @@ -1248,17 +1248,21 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
absFile=pathDec[nbElm-1];

/* failed if the path represents a directory and not an absolute file name*/
if (!lstrcmpW(absFile, bkslashW))
if (!lstrcmpW(absFile, bkslashW)) {
CoTaskMemFree(pathDec);
return MK_E_INVALIDEXTENSION;
}

/* get the extension of the file */
extension = NULL;
length=lstrlenW(absFile);
for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--)
/* nothing */;

if (!extension || !lstrcmpW(extension, dotW))
if (!extension || !lstrcmpW(extension, dotW)) {
CoTaskMemFree(pathDec);
return MK_E_INVALIDEXTENSION;
}

res=RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId);

Expand Down

0 comments on commit 43b5f46

Please sign in to comment.