From ac47f0e09c0710e1fef1c5293895880b46e14328 Mon Sep 17 00:00:00 2001 From: guangwu Date: Wed, 10 Apr 2024 14:35:18 +0800 Subject: [PATCH] fix: close res body --- pkg/reporting/exporters/es/elasticsearch.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/reporting/exporters/es/elasticsearch.go b/pkg/reporting/exporters/es/elasticsearch.go index 68fb64e7e5..7b627492c9 100644 --- a/pkg/reporting/exporters/es/elasticsearch.go +++ b/pkg/reporting/exporters/es/elasticsearch.go @@ -131,7 +131,8 @@ func (exporter *Exporter) Export(event *output.ResultEvent) error { if err != nil { return err } - + defer res.Body.Close() + b, err = io.ReadAll(res.Body) if err != nil { return errors.New(err.Error() + "error thrown by elasticsearch " + string(b))