From patchwork Thu Oct 22 14:56:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 23151 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 130FB44A65A for ; Thu, 22 Oct 2020 17:57:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E3DC468A8F8; Thu, 22 Oct 2020 17:57:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0AD4D689C7E for ; Thu, 22 Oct 2020 17:57:39 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id x7so2836550wrl.3 for ; Thu, 22 Oct 2020 07:57:39 -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=SgD6WD85VPuGWE3JRytIPoEpVxBJxCSP0lPI7z2LhZ8=; b=WOwaKdT81q0MoT76RPUlOTeRe+t+4qQQPiLwLpmJkYiLj9SB5m5mEW9zRdaPfoe3fU jEtUA7e9ThYCzZBHW10poJWB2dBFff1Y2/TQNuLJL/rIMPt/2BQtF3+GIlXBuEmf63K2 qqhdblZs21UKHwTYKHJ82NfNbiqYn0YO3ZwMqJ0meeuR2B6YcqaxHnQzOHES+qswKtw5 oAmKwg/8v3tM0thLNK3wpNd2b16Q608BNe037E4/9Znr7p5L/DFDrXtMECxF34GhZL// eW5kZ+m8aE1r6U1o+ZaXGe580Wl7wCzJyxCSS6GA39YY3h3kTglHFMMORztkgSuwMN9y tF/w== 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=SgD6WD85VPuGWE3JRytIPoEpVxBJxCSP0lPI7z2LhZ8=; b=E4ZD6LG0xZqnLKPJHmsIDI/DOd0SPOVeLeI/3PSGBJDeoz7i0vd5ONRpD9EoBLAexa u5BFAcgveBn8mjvjwt00pzrPLf+bJiyEwhFV2qfobllQS1IlcLD/IM4ycTWO2KmKH3+L qQzOC1HllqGMctqsVRDRJf+B69J73CwcMAhyteKy6M5gk9M8Im5uCPRKgCtKNhYWmADa r3/usEF1qNbkuIgehDax3rp6Ozh4AWWaqAy378F+YrVnc5zSBvYwZ9xviMYlBXcpeYmB 4UFxoiEmtgJI/TeuAZeIFfpUiXHqLxgwbS2V5ijpRNWJjaIbBGNYT7L5FaogzFWBKFPm rZPQ== X-Gm-Message-State: AOAM531X+It7699MlFJhZJZO81/YvyzC8d/OiSArNQt9On+avqAaEVWx KdWGsoLawT5ruskcHS3nSqP2GaYUKX4= X-Google-Smtp-Source: ABdhPJzGXo4tNs86xgvfCND8WifEHP7FotjA+BPYvBksPuC25r8UN32fATClaVUIpmHC9FRtuRbWXw== X-Received: by 2002:adf:f44b:: with SMTP id f11mr3116339wrp.411.1603378658358; Thu, 22 Oct 2020 07:57:38 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id a3sm4711652wrh.94.2020.10.22.07.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 07:57:37 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Oct 2020 16:56:23 +0200 Message-Id: <20201022145624.657457-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201022145624.657457-1-andreas.rheinhardt@gmail.com> References: <20201022145624.657457-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/webp: Return directly when creating Huff table fails 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" Neither the auxiliary VLC table nor the code_lengths array need to be freed if creating the auxiliary VLC table fails. Signed-off-by: Andreas Rheinhardt --- libavcodec/webp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 6b53a7f17c..549d125dcc 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -324,7 +324,7 @@ static int read_huffman_code_normal(WebPContext *s, HuffReader *hc, int alphabet_size) { HuffReader code_len_hc = { { 0 }, 0, 0, { 0 } }; - uint8_t *code_lengths = NULL; + uint8_t *code_lengths; uint8_t code_length_code_lengths[NUM_CODE_LENGTH_CODES] = { 0 }; int i, symbol, max_symbol, prev_code_len, ret; int num_codes = 4 + get_bits(&s->gb, 4); @@ -338,7 +338,7 @@ static int read_huffman_code_normal(WebPContext *s, HuffReader *hc, ret = huff_reader_build_canonical(&code_len_hc, code_length_code_lengths, NUM_CODE_LENGTH_CODES); if (ret < 0) - goto finish; + return ret; code_lengths = av_mallocz(alphabet_size); if (!code_lengths) {