summaryrefslogtreecommitdiff
path: root/win32/wsyslog.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2018-07-06 16:08:17 +0200
committerAnatol Belski <ab@php.net>2018-07-06 16:08:17 +0200
commitd85651d58db45fff28fe63570957539afa332ff4 (patch)
tree587f778944a870feee79ba70372d93a8bcbe2039 /win32/wsyslog.c
parentf3dc67b25553a4d1a32c3705d2cfe06c52d55fa6 (diff)
parent246cb03e261a8fb499a1cdb70d609a19c26a6574 (diff)
downloadphp-git-d85651d58db45fff28fe63570957539afa332ff4.tar.gz
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix event log handling in startup phase Fix bug #76488 Memory leak when fetching a BLOB field Fix year Bump version
Diffstat (limited to 'win32/wsyslog.c')
-rw-r--r--win32/wsyslog.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/win32/wsyslog.c b/win32/wsyslog.c
index 6b0f03e8ea..73f9969a78 100644
--- a/win32/wsyslog.c
+++ b/win32/wsyslog.c
@@ -66,7 +66,7 @@ void closelog(void)
PW32G(log_source) = INVALID_HANDLE_VALUE;
}
if (PW32G(log_header)) {
- efree(PW32G(log_header));
+ free(PW32G(log_header));
PW32G(log_header) = NULL;
}
}
@@ -112,7 +112,6 @@ void syslog(int priority, const char *message, ...)
efree(tmp);
}
-
/* Emulator for BSD openlog() routine
* Accepts: identity
* options
@@ -121,11 +120,14 @@ void syslog(int priority, const char *message, ...)
void openlog(const char *ident, int logopt, int facility)
{
+ size_t header_len;
closelog();
PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION);
- spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
+ header_len = strlen(ident) + 2 + 11;
+ PW32G(log_header) = malloc(header_len*sizeof(char));
+ sprintf_s(PW32G(log_header), header_len, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
}
/*