llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Jinsong Ji (jsji) <details> <summary>Changes</summary> Fix 136-byte memory leak introduced in commit 6dc059ac3c7c. Before that commit, the TextDiagnosticBuffer was passed to DiagnosticsEngine constructor which took ownership and managed its lifetime. After the refactoring, the buffer is no longer passed to DiagnosticsEngine, so it becomes an orphaned allocation that is never freed. Changed to use std::unique_ptr for automatic cleanup. --- Full diff: https://github.com/llvm/llvm-project/pull/191711.diff 1 Files Affected: - (modified) clang/tools/diagtool/ShowEnabledWarnings.cpp (+2-1) ``````````diff diff --git a/clang/tools/diagtool/ShowEnabledWarnings.cpp b/clang/tools/diagtool/ShowEnabledWarnings.cpp index a0c593a3a9105..634f1d53eaaeb 100644 --- a/clang/tools/diagtool/ShowEnabledWarnings.cpp +++ b/clang/tools/diagtool/ShowEnabledWarnings.cpp @@ -58,7 +58,8 @@ static IntrusiveRefCntPtr<DiagnosticsEngine> createDiagnostics(unsigned int argc, char **argv) { // Buffer diagnostics from argument parsing so that we can output them using a // well formed diagnostic object. - TextDiagnosticBuffer *DiagsBuffer = new TextDiagnosticBuffer; + std::unique_ptr<TextDiagnosticBuffer> DiagsBuffer = + std::make_unique<TextDiagnosticBuffer>(); // Try to build the diagnostics parser SmallVector<const char *, 4> Args; `````````` </details> https://github.com/llvm/llvm-project/pull/191711 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
