--- a/src/check_msg.c	2015-08-02 19:31:23.000000000 +0000
+++ b/src/check_msg.c	
@@ -226,22 +226,22 @@ void teardown_messaging(void)
  */
 FILE *open_tmp_file(char **name)
 {
     FILE *file = NULL;
 
-    *name = NULL;
-
 #if !HAVE_MKSTEMP
     /* Windows does not like tmpfile(). This is likely because tmpfile()
      * call unlink() on the file before returning it, to make sure the
      * file is deleted when it is closed. The unlink() call also fails
      * on Windows if the file is still open. */
     /* also note that mkstemp is apparently a C90 replacement for tmpfile */
     /* perhaps all we need to do on Windows is set TMPDIR to whatever is
        stored in TEMP for tmpfile to work */
     /* and finally, the "b" from "w+b" is ignored on OS X, not sure about WIN32 */
 
+    *name = NULL;
+
     file = tmpfile();
     if(file == NULL)
     {
         char *tmp = getenv("TEMP");
         char *tmp_file = tempnam(tmp, "check_");
