netapi32: Set the buffer to NULL in NetApiBufferFree

Juan Lang juan.lang at gmail.com
Thu Jun 26 09:34:51 CDT 2008


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;
     return NERR_Success;
 }

I don't get it.  How does setting a local variable to NULL avoid a
warning about freeing it twice?

I'm not saying the patch is wrong, I'm just saying I don't get how
Valgrind is tricked by this.
--Juan



More information about the wine-devel mailing list