================ @@ -3902,6 +3902,8 @@ void Preprocessor::HandleEmbedDirectiveImpl( } EmbedAnnotationData *Data = new (BP) EmbedAnnotationData; + Data->Filename = Filename; + Data->IsAngled = IsAngled; Data->BinaryData = BinaryContents; ---------------- Fznamznon wrote:
I struggle to see how the current implementation actually prevents the memory leak. `EmbedAnnotationData` is allocated first as if the `std::string` inside was empty, then the string is assigned with an array of chars which will likely extend string's size, giving no chance to deallocate proper size later. I wonder if keeping a `StringRef` in `EmbedAnnotationData` is possible instead. https://github.com/llvm/llvm-project/pull/117770 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits