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,
tvi.cChildren= pEnumIL ? 1 : 0;
tvi.mask |= TVIF_CHILDREN;
lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
if (!lptvid)
if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
return NULL;
if (!GetName(lpsf, pidl, SHGDN_NORMAL, szBuff))
lptvid = SHAlloc( sizeof(TV_ITEMDATA) );
if (!lptvid)
return NULL;
tvi.pszText = szBuff;
......
......@@ -2503,10 +2503,11 @@ LPITEMIDLIST* _ILCopyaPidl(const LPCITEMIDLIST * apidlsrc, UINT cidl)
UINT i;
LPITEMIDLIST *apidldest;
apidldest = SHAlloc(cidl * sizeof(LPITEMIDLIST));
if (!apidlsrc)
return NULL;
apidldest = SHAlloc(cidl * sizeof(LPITEMIDLIST));
for (i = 0; i < cidl; i++)
apidldest[i] = ILClone(apidlsrc[i]);
......
......@@ -1061,7 +1061,7 @@ static HRESULT WINAPI ShellDispatch_IsServiceRunning(IShellDispatch2 *iface, BST
if (!service)
{
ERR("Failed to open service %s (%u)\n", debugstr_w(name), GetLastError());
CloseServiceHandle(service);
CloseServiceHandle(scm);
return S_OK;
}
......
......@@ -3790,7 +3790,10 @@ static BOOL is_knownfolder( struct foldermanager *fm, const KNOWNFOLDERID *id )
hr = get_known_folder_registry_path(id, NULL, &registryPath);
if(SUCCEEDED(hr))
{
hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryPath, 0, 0, &hKey));
HeapFree(GetProcessHeap(), 0, registryPath);
}
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