From 8be04d748cb1c5c5b14571d216e746a5a70a0bf1 Mon Sep 17 00:00:00 2001 From: Marc Guasch Date: Tue, 26 Oct 2021 11:01:55 +0200 Subject: [PATCH] Make allocated map to the size of the header --- x-pack/filebeat/input/httpjson/encoding.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/filebeat/input/httpjson/encoding.go b/x-pack/filebeat/input/httpjson/encoding.go index 9244bdb2f18..38bc6c2ad3a 100644 --- a/x-pack/filebeat/input/httpjson/encoding.go +++ b/x-pack/filebeat/input/httpjson/encoding.go @@ -146,7 +146,7 @@ func decodeAsCSV(p []byte, dst *response) error { event, err := r.Read() for ; err == nil; event, err = r.Read() { - o := map[string]interface{}{} + o := make(map[string]interface{}, len(header)) if len(header) != len(event) { // sanity check, csv.Reader should fail on this scenario // and this code path should be unreachable