diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c index e6bab9533146..354f21b78615 100644 --- a/compiler-rt/lib/profile/InstrProfilingFile.c +++ b/compiler-rt/lib/profile/InstrProfilingFile.c @@ -1088,8 +1088,10 @@ const char *__llvm_profile_get_filename(void) { return "\0"; } Filename = getCurFilename(FilenameBuf, 1); - if (!Filename) + if (!Filename) { + free(FilenameBuf); return "\0"; + } return FilenameBuf; }