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).
My question remains: why does setting a local variable to NULL silence a Valgrind warning? That sounds like a Valgrind bug to me. --Juan