[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61056] branches/soc-2013-viewport_fx/ intern/ghost/intern/GHOST_ContextWGL.cpp: Should not use formattedMsg unless call to FormatMessage succeeded.

Jason Wilkins Jason.A.Wilkins at gmail.com
Sat Nov 2 01:09:27 CET 2013


Revision: 61056
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61056
Author:   jwilkins
Date:     2013-11-02 00:09:26 +0000 (Sat, 02 Nov 2013)
Log Message:
-----------
Should not use formattedMsg unless call to FormatMessage succeeded.

Modified Paths:
--------------
    branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp

Modified: branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp
===================================================================
--- branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp	2013-11-01 18:20:21 UTC (rev 61055)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp	2013-11-02 00:09:26 UTC (rev 61056)
@@ -72,6 +72,8 @@
 
 		const char* msg;
 
+		DWORD count = 0;
+
 		switch (error) {
 			case ERROR_INVALID_VERSION_ARB:
 				msg = "The specified OpenGL version and feature set are either invalid or not supported.\n";
@@ -103,7 +105,6 @@
 
 			default:
 			{
-				DWORD count;
 				count =
 					FormatMessage(
 						(FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -140,7 +141,8 @@
 
 		SetLastError(NO_ERROR);
 
-		LocalFree(formattedMsg);
+		if (count != 0)
+			LocalFree(formattedMsg);
 	}
 
 	return result;




More information about the Bf-blender-cvs mailing list