]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/misc: make DynBuf_Destroy not have a nasty side effect
authorVMware, Inc <>
Thu, 24 Feb 2011 21:35:15 +0000 (13:35 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 24 Feb 2011 21:35:15 +0000 (13:35 -0800)
Dynbuf_Destroy doesn't quite put a dynbuf back as it would be
after initialization and may lead to strange problems.

Fix this.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/misc/dynbuf.c

index be8f19dc349a034636c3f9a9e2373907f6c8df88..7f33ac992595d06bb211b1fbfef675c5ed664466 100644 (file)
@@ -48,7 +48,7 @@
  */
 
 void
-DynBuf_Init(DynBuf *b) // IN
+DynBuf_Init(DynBuf *b)  // OUT:
 {
    ASSERT(b);
 
@@ -75,13 +75,12 @@ DynBuf_Init(DynBuf *b) // IN
  */
 
 void
-DynBuf_Destroy(DynBuf *b) // IN
+DynBuf_Destroy(DynBuf *b)  // IN/OUT:
 {
    ASSERT(b);
 
    free(b->data);
-   b->data = NULL;
-   b->allocated = 0;
+   DynBuf_Init(b);
 }