From patchwork Tue Sep 15 07:39:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22400 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2736A44B636 for ; Tue, 15 Sep 2020 10:40:55 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0182768BC31; Tue, 15 Sep 2020 10:40:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4050768BC51 for ; Tue, 15 Sep 2020 10:40:45 +0300 (EEST) Received: by mail-wm1-f68.google.com with SMTP id d4so2294366wmd.5 for ; Tue, 15 Sep 2020 00:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gh6TwP8ulrqcXUYm7XMrLAhVsTZPigIjuGcJJbNSqxo=; b=T4D0/X68r0ENfX5slcq4uMHVlotoLO3oUWa3sKxHeeYRlITsD7DPE29DthMJVCrG0F bL4NNLHJxQEBq1T3cEizeZQNU08jzMlLCukl+oWU1jEsHnDowl6FkRZ9ao9nDc1Fj4Lo lw7wHfPn+aaV4mw4ZvVnVXTVW4SpQnJLPRJDBIw1npp2bhVTDjfjdXtx5t5RWxvBTPEX FwWLR5mrLYjHJxmlMe5lX1tpBLZSjL8F6nQLrA1Ommw4ym5OxZS0cm1d1j+X8UjLrb/2 fajYlDzEzRiBjxVLHuVZd7SEZEMKp7C00Ll4yxeT782apmaO2iVGekfqnbMEYYM4trmM mNwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gh6TwP8ulrqcXUYm7XMrLAhVsTZPigIjuGcJJbNSqxo=; b=tmaNWqiaJWNc3KX2D/6b4x2IYtOluit1TqLBE1nSqJUOCTXw+Vap4ayeQ/T6e5ADdf NYr53Ltof5Agxo/7oKonu3NbFPmjC6mVErFUYj1+BtsZeIq8RmB9Td0hosSyPvODmj4n CPgglumAUmzWIR2UVNMA5xJJUNCVuQRb7XUbyXvC4yiuvthmAEhLxPeDoSUvDgQqCHLa hoZeWLVt7BvHEid3WtwNloM4hGEn5JWnAdDtU8fjIrEBnItjrvyitacZiv6a63tyZCFw Vjivy6IMLa30mDP4e5+eMLp3WQZexyslXqte/+Ij02VeXJb+Q5DFVrP2BwgJzCbmHkTt ZL9A== X-Gm-Message-State: AOAM531sjPNHVY7BcgT50AbXT/uSEIeZfI63NqVVTFdp6wCsQSwd4BW9 oZlF2c8YJTu+fYmOrQwlTNw6AOts1fM= X-Google-Smtp-Source: ABdhPJwgJlrsKioPNciYAnE4MOZCOqSo5sGnFDyQd2mO6NabBe/BfBlqiOJ5uWUAR+kbAMw6sfUs+w== X-Received: by 2002:a1c:9a57:: with SMTP id c84mr3206597wme.136.1600155644478; Tue, 15 Sep 2020 00:40:44 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id d23sm6112125wmb.6.2020.09.15.00.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 00:40:44 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Sep 2020 09:39:48 +0200 Message-Id: <20200915074000.102622-18-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200915074000.102622-1-andreas.rheinhardt@gmail.com> References: <20200915074000.102622-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 18/30] avcodec/ljpegenc: Don't free buffer known to be NULL X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The lossless JPEG encoder allocates one buffer in its init function and freeing said buffer is the only thing done in its close function. Despite this the init function called the close function if allocating said buffer fails, although there is nothing to free in this case. This commit stops doing this. Signed-off-by: Andreas Rheinhardt --- libavcodec/ljpegenc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c index 70eff9e6fe..39ce5a0089 100644 --- a/libavcodec/ljpegenc.c +++ b/libavcodec/ljpegenc.c @@ -309,7 +309,7 @@ FF_ENABLE_DEPRECATION_WARNINGS s->scratch = av_malloc_array(avctx->width + 1, sizeof(*s->scratch)); if (!s->scratch) - goto fail; + return AVERROR(ENOMEM); ff_idctdsp_init(&s->idsp, avctx); ff_init_scantable(s->idsp.idct_permutation, &s->scantable, @@ -327,9 +327,6 @@ FF_ENABLE_DEPRECATION_WARNINGS avpriv_mjpeg_val_dc); return 0; -fail: - ljpeg_encode_close(avctx); - return AVERROR(ENOMEM); } #define OFFSET(x) offsetof(LJpegEncContext, x)