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";