From patchwork Tue Sep 15 07:39:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22392 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 8A86644B636 for ; Tue, 15 Sep 2020 10:40:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6BA2F68BBCF; Tue, 15 Sep 2020 10:40:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1210168B99E for ; Tue, 15 Sep 2020 10:40:35 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id c18so2136048wrm.9 for ; Tue, 15 Sep 2020 00:40:35 -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=LawyAsLZFGS37hCY46gcFDMzKkTVPUEGQ0gKakEpFLs=; b=fJu3zsWx7mYVLCXR6kDbacDnGVi8VaoY4Kls47jcUrrGYrPMskwKVqswy2RNNVTHlp jBg1V0Vt6j1cxkHr1zsgwUoS9Wm4C1evs4W5Wxl2n5iZfzvPFUkJp6DB59y6jr5BbYjd SKeR6kEu9kapXxbkbF1SAd0TFKXHL2M1bqqMKV5CtXfp8vFe3rl6KoWC9v7Zn1RmFgtE zHrypoynzYy04HgX76aRokko+1DLS1qFXWlVZQHYeu32JO2gnV7gaPzdgODxchU9Fx3C lVA/jmbFzP0pZNz3SJ0uiGB1seZ4LEroCH5YrTanFU8zfj7bRF0Mx1kLeUhjT5GpVw4S tgEg== 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=LawyAsLZFGS37hCY46gcFDMzKkTVPUEGQ0gKakEpFLs=; b=TyER0aVyiEFsf5Iu79/KRdmwyM6RepL2hGN5hT9mt1w6D/3J7b+rS/TCoaN3zMI7as ox4nQpmgzfNU6fcwULoaDVAWtvUo2KQsLxCT71fU7sOWU9WqHOE7Fs6z6SyIB+c3+mqC 3Q21pqJNmXf+GXV2gTk4wDdCTHmQDtmUFplQlI7pxaRLrmclu5MMAlD2sPnUKM4KpNuC bQ736Pjy7OHU8AULp7Fvb2FZuNkmFEaARlStHUrsXh7LYOJ5Y/VUj0rinouB6PnkdRgb 2hCliQlI5VcDv5E8Ktv2D8Sv9cqg4JrG21SereFFRxEA7reUN+g1RTGbYQ+FiKBaeHsR 6BGg== X-Gm-Message-State: AOAM532b6t0TwjwD9TipzZgHahJHOoDiNFHZm/d8yQNieo1u1qMAjHoH qyk2KqpKVXhaz1VlS6hq+llDWoYO6FA= X-Google-Smtp-Source: ABdhPJzUnBnCo5x8TX8iijFkRBEbC4S80nhATXRz2Xzk2t+G6xLsoeNJL7ZRxhHboL7F6XjPiqOeJA== X-Received: by 2002:adf:f34f:: with SMTP id e15mr19102730wrp.387.1600155634384; Tue, 15 Sep 2020 00:40:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 00:40:33 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Sep 2020 09:39:38 +0200 Message-Id: <20200915074000.102622-8-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 08/30] avcodec/hcom: Cleanup generically upon init failure 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" Signed-off-by: Andreas Rheinhardt --- libavcodec/hcom.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c index 8300676f98..06fa25fcd2 100644 --- a/libavcodec/hcom.c +++ b/libavcodec/hcom.c @@ -67,15 +67,11 @@ static av_cold int hcom_init(AVCodecContext *avctx) if (s->dict[i].l >= 0 && (s->dict[i].l >= s->dict_entries || s->dict[i].r >= s->dict_entries || - s->dict[i].r < 0 )) { - av_freep(&s->dict); + s->dict[i].r < 0 )) return AVERROR_INVALIDDATA; - } } - if (s->dict[0].l < 0) { - av_freep(&s->dict); + if (s->dict[0].l < 0) return AVERROR_INVALIDDATA; - } avctx->sample_fmt = AV_SAMPLE_FMT_U8; s->dict_entry = 0; @@ -148,4 +144,5 @@ AVCodec ff_hcom_decoder = { .close = hcom_close, .decode = hcom_decode, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, };