Commit b4b396a9 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

shell32: Reorder code to avoid memory leaks (coverity).

parent 81c0e1ea
...@@ -369,11 +369,11 @@ static HTREEITEM InsertTreeViewItem( browse_info *info, IShellFolder * lpsf, ...@@ -369,11 +369,11 @@ static HTREEITEM InsertTreeViewItem( browse_info *info, IShellFolder * lpsf,
tvi.cChildren= pEnumIL ? 1 : 0; tvi.cChildren= pEnumIL ? 1 : 0;
tvi.mask |= TVIF_CHILDREN; tvi.mask |= TVIF_CHILDREN;
lptvid = SHAlloc( sizeof(TV_ITEMDATA) ); if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
if (!lptvid)
return NULL; return NULL;
if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff)) lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
if (!lptvid)
return NULL; return NULL;
tvi.pszText = szBuff; tvi.pszText = szBuff;
......
...@@ -2503,10 +2503,11 @@ LPITEMIDLIST* _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl) ...@@ -2503,10 +2503,11 @@ LPITEMIDLIST* _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl)
UINT i; UINT i;
LPITEMIDLIST *apidldest; LPITEMIDLIST *apidldest;
apidldest = SHAlloc(cidl * sizeof(LPITEMIDLIST));
if (!apidlsrc) if (!apidlsrc)
return NULL; return NULL;
apidldest = SHAlloc(cidl * sizeof(LPITEMIDLIST));
for (i = 0; i < cidl; i++) for (i = 0; i < cidl; i++)
apidldest[i] = ILClone(apidlsrc[i]); apidldest[i] = ILClone(apidlsrc[i]);
......
...@@ -1061,7 +1061,7 @@ static HRESULT WINAPI ShellDispatch_IsServiceRunning(IShellDispatch2 *iface, BST ...@@ -1061,7 +1061,7 @@ static HRESULT WINAPI ShellDispatch_IsServiceRunning(IShellDispatch2 *iface, BST
if (!service) if (!service)
{ {
ERR("Failed to open service %s (%u)\n", debugstr_w(name), GetLastError()); ERR("Failed to open service %s (%u)\n", debugstr_w(name), GetLastError());
CloseServiceHandle(service); CloseServiceHandle(scm);
return S_OK; return S_OK;
} }
......
...@@ -3790,7 +3790,10 @@ static BOOL is_knownfolder( struct foldermanager *fm, const KNOWNFOLDERID *id ) ...@@ -3790,7 +3790,10 @@ static BOOL is_knownfolder( struct foldermanager *fm, const KNOWNFOLDERID *id )
hr = get_known_folder_registry_path(id, NULL, &registryPath); hr = get_known_folder_registry_path(id, NULL, &registryPath);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{
hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryPath, 0, 0, &hKey)); hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryPath, 0, 0, &hKey));
HeapFree(GetProcessHeap(), 0, registryPath);
}
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment