diff --git a/plugins/in_winevtlog/winevtlog.c b/plugins/in_winevtlog/winevtlog.c index 90c3b19b13d..d5fc6fa42a2 100644 --- a/plugins/in_winevtlog/winevtlog.c +++ b/plugins/in_winevtlog/winevtlog.c @@ -301,7 +301,7 @@ PWSTR get_message(EVT_HANDLE metadata, EVT_HANDLE handle, unsigned int *message_ if (!buffer) { flb_error("failed to premalloc message buffer"); - goto cleanup; + goto buffer_error; } // Get the size of the buffer @@ -316,7 +316,7 @@ PWSTR get_message(EVT_HANDLE metadata, EVT_HANDLE handle, unsigned int *message_ flb_error("failed to malloc message buffer"); flb_free(previous_buffer); - goto cleanup; + goto buffer_error; } if (!EvtFormatMessage(metadata, @@ -386,6 +386,8 @@ PWSTR get_message(EVT_HANDLE metadata, EVT_HANDLE handle, unsigned int *message_ flb_free(buffer); } +buffer_error: + return message; }