diff options
author | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 20:54:47 +0000 |
---|---|---|
committer | lambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 20:54:47 +0000 |
commit | 8c830932589af1141a1d24e6b68de21c21d8c7e4 (patch) | |
tree | 8d297db588882ff5bf7f6693fbd7e15c88112b54 /remoting | |
parent | 97f0e02a13bc5eb41f95ddbe8cd562a40a5bf1e0 (diff) | |
download | chromium_src-8c830932589af1141a1d24e6b68de21c21d8c7e4.zip chromium_src-8c830932589af1141a1d24e6b68de21c21d8c7e4.tar.gz chromium_src-8c830932589af1141a1d24e6b68de21c21d8c7e4.tar.bz2 |
Don't delete memory passed to openlog/syslog.
Fixes the problem where syslog wrote a blank tag instead of
"chromoting_me2me_host" (problem seen after applying
http://codereview.chromium.org/9234070/)
BUG=None
TEST=Manual
Review URL: http://codereview.chromium.org/9143003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/system_event_logger_linux.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/remoting/host/system_event_logger_linux.cc b/remoting/host/system_event_logger_linux.cc index 4518d5d..7100006 100644 --- a/remoting/host/system_event_logger_linux.cc +++ b/remoting/host/system_event_logger_linux.cc @@ -15,14 +15,23 @@ namespace { class SystemEventLoggerLinux : public SystemEventLogger { public: - SystemEventLoggerLinux(const std::string& application_name) { - openlog(application_name.c_str(), 0, LOG_USER); + SystemEventLoggerLinux(const std::string& application_name) + : application_name_(application_name) { + openlog(application_name_.c_str(), 0, LOG_USER); + } + + ~SystemEventLoggerLinux() { + closelog(); } virtual void Log(const std::string& message) OVERRIDE { syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); } + private: + // Store this string here, to avoid deleting memory passed to openlog(). + std::string application_name_; + DISALLOW_COPY_AND_ASSIGN(SystemEventLoggerLinux); }; |