From: Stefan Hundhammer Date: Mon, 11 Apr 2016 13:44:20 +0000 (+0200) Subject: Make sure 'component' string is not destroyed prematurely (bsc#940154) X-Git-Tag: v0.3.3~9^2~1 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=7431bc468b5c0560c2d5073cdc3bc0db5fccd5fe;p=thirdparty%2Fsnapper.git Make sure 'component' string is not destroyed prematurely (bsc#940154) --- diff --git a/snapper/Log.cc b/snapper/Log.cc index 82c9152d..849b6f63 100644 --- a/snapper/Log.cc +++ b/snapper/Log.cc @@ -29,13 +29,14 @@ namespace snapper using namespace std; - const string component = "libsnapper"; + // Intentionally leaving this behind as a mem leak (bsc#940154) + const string* component = new string("libsnapper"); bool testLogLevel(LogLevel level) { - return callLogQuery(level, component); + return callLogQuery(level, *component); } @@ -61,7 +62,7 @@ namespace snapper logStreamClose(LogLevel level, const char* file, unsigned line, const char* func, ostringstream* stream) { - callLogDo(level, component, file, line, func, stream->str()); + callLogDo(level, *component, file, line, func, stream->str()); delete stream; }