[PATCH] D49666: [profile] Fix a possible memory leak in parseFilenamePattern().

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 05:29:14 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337823: [profile] Fix a possible memory leak in parseFilenamePattern(). (authored by ikudrin, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D49666?vs=156752&id=157009#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49666

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


Index: compiler-rt/trunk/lib/profile/InstrProfilingFile.c
===================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingFile.c
+++ compiler-rt/trunk/lib/profile/InstrProfilingFile.c
@@ -318,12 +318,12 @@
   if (lprofCurFilename.Filename)
     free((void *)lprofCurFilename.Filename);
 
-  memset(&lprofCurFilename, 0, sizeof(lprofCurFilename));
-
   if (lprofCurFilename.FilenamePat && lprofCurFilename.OwnsFilenamePat) {
     free((void *)lprofCurFilename.FilenamePat);
   }
 
+  memset(&lprofCurFilename, 0, sizeof(lprofCurFilename));
+
   if (!CopyFilenamePat)
     lprofCurFilename.FilenamePat = FilenamePat;
   else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49666.157009.patch
Type: text/x-patch
Size: 677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180724/ae51b3b3/attachment.bin>


More information about the llvm-commits mailing list