]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Polish: remove dead code added by rev.12670
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 14 Feb 2013 03:42:26 +0000 (20:42 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 14 Feb 2013 03:42:26 +0000 (20:42 -0700)
Remove the do_free_filename hack which on most modern systems causes the
extra if() code and local variable to be optimized out.

Detected by Coverity Scan. Issue 980999.

src/tools.cc

index 524f59c23d55d4b584b2e6ed40b213f0ee625280..87da3f35616d5897d0a4e1660dae9add4d84ba1a 100644 (file)
@@ -130,7 +130,6 @@ mail_warranty(void)
 {
     FILE *fp = NULL;
     static char command[256];
-    bool do_free_filename=false;
 
     const mode_t prev_umask=umask(S_IRWXU);
 
@@ -143,7 +142,6 @@ mail_warranty(void)
     }
 #else
     char *filename;
-    do_free_filename=true;
     // XXX tempnam is obsolete since POSIX.2008-1
     // tmpfile is not an option, we want the created files to stick around
     if ((filename = tempnam(NULL, APP_SHORTNAME)) == NULL ||
@@ -166,8 +164,9 @@ mail_warranty(void)
     snprintf(command, 256, "%s %s < %s", Config.EmailProgram, Config.adminEmail, filename);
     if (system(command)) {}            /* XXX should avoid system(3) */
     unlink(filename);
-    if (do_free_filename)
-        xfree(filename);
+#if !HAVE_MKSTEMP
+    xfree(filename); // tempnam() requires us to free its allocation
+#endif
 }
 
 void