2008/6/26 Kai Blin <[EMAIL PROTECTED]>:
> On Thursday 26 June 2008 16:34:51 you wrote:
>
>> @@ -52,6 +52,7 @@ NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
>> {
>> TRACE("(%p)\n", Buffer);
>> HeapFree(GetProcessHeap(), 0, Buffer);
>> +Buffer = NULL;
>> return NERR_Succes
On Thursday 26 June 2008 19:51:41 Juan Lang wrote:
> So setting Buffer' to NULL has no impact on the HeapFree of Buffer''.
> The fact that this makes a Valgrind warning disappear still seems like
> a Valgrind bug. If it were doing static analysis, I'd say it's gotten
> confused by aliasing. Since
> You said Buffer was a local variable, but it's a parameter passed from the
> test.
>From the point of view of NetApiBufferFree, Buffer is a parameter,
which is equivalent to a local variable. In C, all parameters are
pass-by-value. You can simulate pass-by-reference by passing a
pointer, but i
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
> 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 He
On Thu, Jun 26, 2008 at 10:50 AM, Juan Lang <[EMAIL PROTECTED]> wrote:
>> The fix should be
>>*Buffer = NULL;
>> not
>>Buffer = NULL;
>> since p (in the tests) would still be valid after the NetApiBufferFree call.
>
> That's also not correct, as you'd be dereferencing an invalid pointer.
>
> The fix should be
>*Buffer = NULL;
> not
>Buffer = NULL;
> since p (in the tests) would still be valid after the NetApiBufferFree call.
That's also not correct, as you'd be dereferencing an invalid pointer.
NetApiBufferFree takes a void *, not a void ** (unlike
NetApiBufferAllocate).
M
On Thursday 26 June 2008 16:34:51 you wrote:
> @@ -52,6 +52,7 @@ NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
> {
> TRACE("(%p)\n", Buffer);
> HeapFree(GetProcessHeap(), 0, Buffer);
> +Buffer = NULL;
> return NERR_Success;
> }
>
> I don't get it. How does setting a l
Kai Blin wrote:
> This fixes a Valgrind warning triggered by the NetApiBufferFree() test
> where a buffer is free()d twice.
@@ -52,6 +52,7 @@ NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
{
TRACE("(%p)\n", Buffer);
HeapFree(GetProcessHeap(), 0, Buffer);
+Buffer = NULL;