From: Amos Jeffries Date: Thu, 14 Feb 2013 03:42:26 +0000 (-0700) Subject: Polish: remove dead code added by rev.12670 X-Git-Tag: SQUID_3_4_0_1~276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87cedd31e406b423f84d583c44c80cc983ff1631;p=thirdparty%2Fsquid.git Polish: remove dead code added by rev.12670 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. --- diff --git a/src/tools.cc b/src/tools.cc index 524f59c23d..87da3f3561 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -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