summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2016-09-11 11:25:04 +0100
committerChris Wilson <chris+github@qwirx.com>2016-09-11 11:25:04 +0100
commit8b73c13dd60080c701314ac06b6180c88e7a4422 (patch)
tree61ae2b7310c89cf0d43f559b7dbaa5a30cba3bda /lib
parent6d9b8278659d1828774af355cda5afeef2b31d57 (diff)
Simplify AddEventSource usage, avoid strdup().
Diffstat (limited to 'lib')
-rw-r--r--lib/win32/emu.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp
index c78fe6b2..1f6392d5 100644
--- a/lib/win32/emu.cpp
+++ b/lib/win32/emu.cpp
@@ -1313,7 +1313,7 @@ int poll (struct pollfd *ufds, unsigned long nfds, int timeout)
BOOL AddEventSource
(
- LPTSTR pszSrcName, // event source name
+ const std::string& name, // event source name
DWORD dwNum // number of categories
)
{
@@ -1335,7 +1335,7 @@ BOOL AddEventSource
std::string regkey("SYSTEM\\CurrentControlSet\\Services\\EventLog\\"
"Application\\");
- regkey += pszSrcName;
+ regkey += name;
HKEY hk;
DWORD dwDisp;
@@ -1448,10 +1448,7 @@ void openlog(const char * daemonName, int, int)
gSyslogH = INVALID_HANDLE_VALUE;
}
- char* name = strdup(nameStr.c_str());
- BOOL success = AddEventSource(name, 0);
- free(name);
-
+ BOOL success = AddEventSource(nameStr, 0);
if (!success)
{
::syslog(LOG_ERR, "Failed to add our own event source");