Hi Ge,
On Saturday 13 August 2005 20:55, Ge van Geldorp wrote:
dwAttributes = SFGAO_FILESYSTEM; hr = IShellFolder_GetAttributesOf(psfFolder, 1, &pidlLast,
&dwAttributes); - if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) return FALSE; + if (FAILED(hr) || !(dwAttributes & SFGAO_FILESYSTEM)) {
IShellFolder_Release(psfFolder);
ILFree((LPITEMIDLIST) pidlLast);
return FALSE;
- }
I had another look at this after realising that Alexandre did'nt apply the patch. SHBindToParent does not allocate a new PIDL for pidlLast, but returns a pointer to right location in pidl. This means you should not free it. There's still the problem that the shell folder isn't released in failure cases.
Sorry, I didn't realize this. Once again I'm impressed that Alexandre always catches those things.
Bye,
From: Michael Jung
SHBindToParent does not allocate a new PIDL for pidlLast, but returns a pointer to right location in pidl. This means you should not free it. There's still the problem that the shell folder isn't released in failure cases.
Sorry, I didn't realize this.
I feel a bit silly for not catching it either. MSDN is very clear about this. I've resubmitted a patch which only releases the interface pointer.
Gé van Geldorp.