From: VMware, Inc <> Date: Thu, 24 Feb 2011 21:35:15 +0000 (-0800) Subject: lib/misc: make DynBuf_Destroy not have a nasty side effect X-Git-Tag: 2011.02.23-368700~65 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a17e39ca6f4910520eb3fe7ab258251d7230af7e;p=thirdparty%2Fopen-vm-tools.git lib/misc: make DynBuf_Destroy not have a nasty side effect 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 --- diff --git a/open-vm-tools/lib/misc/dynbuf.c b/open-vm-tools/lib/misc/dynbuf.c index be8f19dc3..7f33ac992 100644 --- a/open-vm-tools/lib/misc/dynbuf.c +++ b/open-vm-tools/lib/misc/dynbuf.c @@ -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); }