[Mobies-commit] [commit] r3807 - GReAT/trunk/Tools/CodeGenerator/CG_interpreter

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Thu Jul 28 14:20:50 CDT 2011


Author: ksmyth
Date: Thu Jul 28 14:20:50 2011
New Revision: 3807

Log:
Fix memory leak

Modified:
   GReAT/trunk/Tools/CodeGenerator/CG_interpreter/UdmApp.cpp

Modified: GReAT/trunk/Tools/CodeGenerator/CG_interpreter/UdmApp.cpp
==============================================================================
--- GReAT/trunk/Tools/CodeGenerator/CG_interpreter/UdmApp.cpp	Thu Jul 28 14:20:09 2011	(r3806)
+++ GReAT/trunk/Tools/CodeGenerator/CG_interpreter/UdmApp.cpp	Thu Jul 28 14:20:50 2011	(r3807)
@@ -146,8 +146,10 @@
 				FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
 								NULL, le, 0, (LPTSTR) &lpMsgBuf, 0, NULL );
 				string msg = "CG Error: Unable to create directory " + CodeGenDir + "\n";
-				msg += (LPCSTR)lpMsgBuf;
-				LocalFree(lpMsgBuf);
+				if (lpMsgBuf) {
+					  msg += (LPCSTR)lpMsgBuf;
+					  LocalFree(lpMsgBuf);
+				}
 				throw udm_exception(msg.c_str());
 			}
 		}


More information about the Mobies-commit mailing list