r600: Fix small leak in SfnLog

stderr_streambuf used to not get destroyed with SfnLog

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15412>
This commit is contained in:
wingdeans 2022-03-16 16:10:53 +00:00 committed by Marge Bot
parent 23f38553c8
commit 0819869ca8
2 changed files with 13 additions and 11 deletions

View file

@ -29,16 +29,6 @@
namespace r600 {
class stderr_streambuf : public std::streambuf
{
public:
stderr_streambuf();
protected:
int sync();
int overflow(int c);
std::streamsize xsputn ( const char *s, std::streamsize n );
};
stderr_streambuf::stderr_streambuf()
{
@ -87,7 +77,8 @@ std::streamsize stderr_streambuf::xsputn ( const char *s, std::streamsize n )
SfnLog::SfnLog():
m_active_log_flags(0),
m_log_mask(0),
m_output(new stderr_streambuf())
m_buf(),
m_output(&m_buf)
{
m_log_mask = debug_get_flags_option("R600_NIR_DEBUG", sfn_debug_options, 0);
m_log_mask ^= err;

View file

@ -38,6 +38,16 @@ namespace r600 {
*/
class stderr_streambuf : public std::streambuf
{
public:
stderr_streambuf();
protected:
int sync();
int overflow(int c);
std::streamsize xsputn ( const char *s, std::streamsize n );
};
class SfnLog {
public:
enum LogFlag {
@ -95,6 +105,7 @@ public:
private:
uint64_t m_active_log_flags;
uint64_t m_log_mask;
stderr_streambuf m_buf;
std::ostream m_output;
};