From dae88a1911b97ba004aa7bfdc3df505c51e6e6fc Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Mon, 30 Oct 2023 15:05:14 +0000 Subject: [PATCH] Fix memory leak in generator plugin code Signed-off-by: Michael Carroll --- core/generator/Generator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/generator/Generator.cc b/core/generator/Generator.cc index 1fafd43b..a4a64671 100644 --- a/core/generator/Generator.cc +++ b/core/generator/Generator.cc @@ -114,9 +114,9 @@ bool Generator::Generate(const FileDescriptor *_file, sourceFilename += part.string() + "/"; } - auto message_type_index = - _generatorContext->Open(identifier + fileStem + ".pb_index"); - io::Printer indexPrinter(message_type_index, '$'); + std::unique_ptr message_type_index( + _generatorContext->Open(identifier + fileStem + ".pb_index")); + io::Printer indexPrinter(message_type_index.get(), '$'); identifier += fileStem; headerFilename += fileStem + ".gz.h";