Skip to content

Commit

Permalink
in_winetvlog: Handle buffer allocation error
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jun 26, 2024
1 parent 060418c commit eb96c34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/in_winevtlog/winevtlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -386,6 +386,8 @@ PWSTR get_message(EVT_HANDLE metadata, EVT_HANDLE handle, unsigned int *message_
flb_free(buffer);
}

buffer_error:

return message;
}

Expand Down

0 comments on commit eb96c34

Please sign in to comment.