From a551bfcafc6137e5e592d1af26847625e66c75e8 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 5 Dec 2002 16:52:55 -0500 Subject: fix free before use --- Source/cmDynamicLoader.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx index 8c76ad1..a19b6be 100644 --- a/Source/cmDynamicLoader.cxx +++ b/Source/cmDynamicLoader.cxx @@ -294,10 +294,11 @@ const char* cmDynamicLoader::LastError() ); // Free the buffer. - LocalFree( lpMsgBuf ); + static char* str = 0; delete [] str; - str = strcpy(new char[strlen((char*)lpMsgBuf)+1], (char*)lpMsgBuf); + str = strcpy(new char[strlen((char*)lpMsgBuf)+1], (char*)lpMsgBuf); + LocalFree( lpMsgBuf ); return str; } -- cgit v0.12