diff --git a/src/glog/logging.h b/src/glog/logging.h index b69fc506e..daa523d4e 100644 --- a/src/glog/logging.h +++ b/src/glog/logging.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -590,12 +591,13 @@ DECLARE_string(logmailer); FORMAT_MESSAGE_FROM_SYSTEM | \ FORMAT_MESSAGE_IGNORE_INSERTS, \ 0, result, 0, msg, 100, nullptr); \ + std::unique_ptr release(message, \ + &LocalFree); \ if (message_length > 0) { \ google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, 0, \ &google::LogMessage::SendToLog) \ .stream() \ << reinterpret_cast(message); \ - LocalFree(message); \ } \ } #endif