On Thursday 26 June 2008 18:07:59 you wrote:
> > Not that I know anything but it seems that HeapFree calls RtlFreeHeap
> > and RtlFreeHeap checks to make sure the pointer is not null before
> > trying to free it.  So explicitly setting it to null makes the erorr
> > go away.
>
> That might be true if setting Buffer to NULL happened before the call
> to HeapFree, but it happens after.  After the return from
> NetApiBufferFree, Buffer goes out of scope, and a subsequent call
> won't be affected by it.

You said Buffer was a local variable, but it's a parameter passed from the 
test.

So, as far as I can see, the test does

Buffer = HeapAlloc(GetProcessHeap(), NULL, 1024);

HeapReAlloc(GetProcessHeap(),  0, Buffer, 1500);

HeapFree(GetProcessHeap(), 0, Buffer);
HeapFree(GetProcessHeap(), 0, Buffer);

That's a double free, right? Valgrind is complaining about the second one. 
HeapFree() on a NULL buffer doesn't do anything, so it's not causing a 
Valgrind error anymore.

Cheers,
Kai

-- 
Kai Blin
WorldForge developer  http://www.worldforge.org/
Wine developer        http://wiki.winehq.org/KaiBlin
Samba team member     http://www.samba.org/samba/team/
--
Will code for cotton.

Attachment: signature.asc
Description: This is a digitally signed message part.



Reply via email to