[compiler-rt] [compiler-rt][profile] Duplicate filename in `parseAndSetFilename` if exists (PR #110264)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 00:03:32 PDT 2024


================
@@ -923,6 +925,9 @@ static void parseAndSetFilename(const char *FilenamePat,
       PROF_NOTE("Override old profile path \"%s\" via %s to \"%s\" via %s.\n",
                 OldFilenamePat, getPNSStr(OldPNS), lprofCurFilename.FilenamePat,
                 getPNSStr(PNS));
+
+    free(OldFilenamePat);
----------------
mstorsjo wrote:

Wouldn't this new allocation be leaked if we return in either of the two returns above, between the alloc and this free?

https://github.com/llvm/llvm-project/pull/110264


More information about the llvm-commits mailing list