From d60fbdd1aed931fe5f8ed7cd013a82cfc0917a35 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 19 Aug 2022 14:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_writer.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/nodes/http_writer.go b/internal/nodes/http_writer.go index 630a306..90ff349 100644 --- a/internal/nodes/http_writer.go +++ b/internal/nodes/http_writer.go @@ -1011,7 +1011,6 @@ func (this *HTTPWriter) finishWebP() { anim.WebPAnimEncoderOptions.SetKmin(9) anim.WebPAnimEncoderOptions.SetKmax(17) - defer anim.ReleaseMemory() var webpConfig = gowebp.NewWebpConfig() //webpConfig.SetLossless(1) webpConfig.SetQuality(f) @@ -1030,13 +1029,13 @@ func (this *HTTPWriter) finishWebP() { if lastErr != nil { remotelogs.Error("HTTP_WRITER", "'"+this.req.URL()+"' encode webp failed: "+lastErr.Error()) } - if err == nil { - err = anim.AddFrame(nil, timeline, webpConfig) + err = anim.AddFrame(nil, timeline, webpConfig) - if err == nil { - err = anim.Encode(this.writer) - } + if err == nil { + err = anim.Encode(this.writer) } + + anim.ReleaseMemory() } if err != nil && !this.req.canIgnore(err) {