[compiler-rt] r276089 - Minor cleanup -- clear name structure before parsing

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 22:10:56 PDT 2016


Author: davidxl
Date: Wed Jul 20 00:10:56 2016
New Revision: 276089

URL: http://llvm.org/viewvc/llvm-project?rev=276089&view=rev
Log:
Minor cleanup -- clear name structure before parsing

Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingFile.c

Modified: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingFile.c?rev=276089&r1=276088&r2=276089&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c Wed Jul 20 00:10:56 2016
@@ -266,6 +266,11 @@ static int parseFilenamePattern(const ch
   char *Hostname = &lprofCurFilename.Hostname[0];
   int MergingEnabled = 0;
 
+  /* Clean up cached prefix.  */
+  if (lprofCurFilename.ProfilePathPrefix)
+    free((void *)lprofCurFilename.ProfilePathPrefix);
+  memset(&lprofCurFilename, 0, sizeof(lprofCurFilename));
+
   lprofCurFilename.FilenamePat = FilenamePat;
   /* Check the filename for "%p", which indicates a pid-substitution. */
   for (I = 0; FilenamePat[I]; ++I)
@@ -345,12 +350,6 @@ static void parseAndSetFilename(const ch
               getPNSStr(PNS));
   }
 
-  /* Clean up cached prefix.  */
-  if (lprofCurFilename.ProfilePathPrefix) {
-    free((void*)lprofCurFilename.ProfilePathPrefix);
-    lprofCurFilename.ProfilePathPrefix = NULL;
-  }
-
   if (!lprofCurFilename.MergePoolSize)
     truncateCurrentFile();
 }




More information about the llvm-commits mailing list