From e01d391c0bb2b8ebb7a433e8902f0fbb34a098fe Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Tue, 27 Oct 2020 18:25:00 +0000 Subject: [PATCH] Fix crash on Windows if loading a plugin fails. Closes #1866. Thanks to roebotron. --- ChangeLog.txt | 1 + src/security.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 8fa8ba61..6977399d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -62,6 +62,7 @@ Broker: - Fix `log_timestamp_format` not applying to `log_dest topic`. Closes #1862. - Add the `bridge_max_packet_size` option. Closes #265. - Add the `bridge_bind_address` option. Closes #1311. +- Fix crash on Windows if loading a plugin fails. Closes #1866. Client library: - Client no longer generates random client ids for v3.1.1 clients, these are diff --git a/src/security.c b/src/security.c index ea70cfc2..f3856d94 100644 --- a/src/security.c +++ b/src/security.c @@ -35,7 +35,7 @@ void LIB_ERROR(void) { #ifdef WIN32 char *buf; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), LANG_NEUTRAL, (LPTSTR)&buf, 0, NULL); log__printf(NULL, MOSQ_LOG_ERR, "Load error: %s", buf); LocalFree(buf);