diff --git a/llvm/lib/ProfileData/MemProfReader.cpp b/llvm/lib/ProfileData/MemProfReader.cpp index 85327273d6d7b..5e2d76e24dab7 100644 --- a/llvm/lib/ProfileData/MemProfReader.cpp +++ b/llvm/lib/ProfileData/MemProfReader.cpp @@ -633,6 +633,8 @@ Error RawMemProfReader::symbolizeAndFilterStackFrames( // Drop the entries where the callstack is empty. for (const uint64_t Id : EntriesToErase) { StackMap.erase(Id); + if(CallstackProfileData[Id].AccessHistogramSize > 0) + free((void*) CallstackProfileData[Id].AccessHistogram); CallstackProfileData.erase(Id); }