Skip to content

Commit eb74bd8

Browse files
committed
create space for header before use
Signed-off-by: Gil Raphaelli <[email protected]>
1 parent d21e8de commit eb74bd8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugins/out_es/es.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,11 +890,12 @@ static void cb_es_flush(struct flb_event_chunk *event_chunk,
890890
flb_http_basic_auth(c, ctx->cloud_user, ctx->cloud_passwd);
891891
}
892892
else if (ctx->http_api_key) {
893-
header_line = flb_sds_printf(NULL, "ApiKey %s", ctx->http_api_key);
893+
header_line = flb_sds_create_size(48);
894894
if (header_line == NULL) {
895895
flb_plg_error(ctx->ins, "failed to format API key auth header");
896896
goto retry;
897897
}
898+
header_line = flb_sds_printf(&header_line, "ApiKey %s", ctx->http_api_key);
898899

899900
if (flb_http_add_header(c,
900901
FLB_HTTP_HEADER_AUTH, strlen(FLB_HTTP_HEADER_AUTH),

0 commit comments

Comments
 (0)