Browse Source

fix free before use

Bill Hoffman 23 years ago
parent
commit
a551bfcafc
1 changed files with 3 additions and 2 deletions
  1. 3 2
      Source/cmDynamicLoader.cxx

+ 3 - 2
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;
 }