summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/profile/InstrProfilingFile.c
diff options
context:
space:
mode:
authorIgor Kudrin <ikudrin@accesssoftek.com>2018-07-24 12:28:53 +0000
committerIgor Kudrin <ikudrin@accesssoftek.com>2018-07-24 12:28:53 +0000
commit63600c7487dcdd10f0e10a35ffe2f5f9f538ddda (patch)
tree3cafe268d20733ea9053face44b4a278c7ed5185 /compiler-rt/lib/profile/InstrProfilingFile.c
parent376113da89d0b32bfcbdfea6476ab441f4ef3537 (diff)
downloadbcm5719-llvm-63600c7487dcdd10f0e10a35ffe2f5f9f538ddda.tar.gz
bcm5719-llvm-63600c7487dcdd10f0e10a35ffe2f5f9f538ddda.zip
[profile] Fix a possible memory leak in parseFilenamePattern().
Differential Revision: https://reviews.llvm.org/D49666 llvm-svn: 337823
Diffstat (limited to 'compiler-rt/lib/profile/InstrProfilingFile.c')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingFile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index f6013ad2299..68ba923fdaa 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -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 {
OpenPOWER on IntegriCloud