Skip to content

Commit

Permalink
[profile] Fix a possible memory leak in parseFilenamePattern().
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D49666

llvm-svn: 337823
  • Loading branch information
igorkudrin committed Jul 24, 2018
1 parent 376113d commit 63600c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler-rt/lib/profile/InstrProfilingFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ static int parseFilenamePattern(const char *FilenamePat,
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 {
Expand Down

0 comments on commit 63600c7

Please sign in to comment.