From patchwork Mon Sep 14 05:27: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: 22367 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 7F348448249 for ; Mon, 14 Sep 2020 08:36:00 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6C8526880F3; Mon, 14 Sep 2020 08:36:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A520468BC3E for ; Mon, 14 Sep 2020 08:35:58 +0300 (EEST) Received: by mail-lj1-f194.google.com with SMTP id y4so17468514ljk.8 for ; Sun, 13 Sep 2020 22:35:58 -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=RWV+vA1uEM3C3zSgga3nFLvw11soWnJ3UWjcKEuz0pQ=; b=pZsJvIlRqayeOkyhwhmk8KKcDDlNrP4+IdAFZex5fxvnOzA+nIZ7hXBlMrV1xNm0yk pxbT0kd6llzEe9/dAT4oFaax+ehomBASOQ6epCwtZAoU9TaN3mSzGNbQzNAm3P79UfQn MkUwvLVf9Eju2hqD59qd0wvcCkPoeMS7kU1AuUxPs7wFJz/ic/NsplfJKl+yVNCmN0yG LqjIAdV7taoRJPDd6DJAmYfgWBfsLqJqZwjRDZjLiFADwHl0CksHGiPvTZ1OhT2dk5jH ICSylOos7FxV07KzyIBuNLAlWEVbtfs43TxTrUVyzrnkFszOC6f20jJg1NiW+svAe5nE w8SQ== 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=RWV+vA1uEM3C3zSgga3nFLvw11soWnJ3UWjcKEuz0pQ=; b=HFvY5Lz1vLxslQuCrDyapaMumc7hQ/3+pphos2DWz1YOl2clqkQXOTy/z0/JIwD5av aTSCdQyXheNI37rdYhHq6oeMxS1HekZKP9dbrKNPDfsUzyK3T3Ehmyy2wCswq1eRcNUi tP9yuMtu1ApemkvnQpuxsbXNdrFIwuBNSPn6/Cg5x9N9Vn8SkbAX5ZnNARoQb4qiULTl 97yjPMzOzOoE50eyO10qEfdhw1pJmg+4zlSIo9c0z4Y/Djy4NsbEV5tvXqySAIpRHaKF bslGoXwQBwOggJ3x7Mti0o50pbsBNvzmd3KD//alGJgp3U3mLAQ8xIxpwG1L3diyjqT9 eqIw== X-Gm-Message-State: AOAM5336hMr0cM6ygFcT/EOfFedo5O7fi7wTYKKWZHHrFClFs1sUIjjz t7lhd23KMXIEzs29PHpas/RWwjPx/jA= X-Google-Smtp-Source: ABdhPJzGbWO+79Xkln4SWmdcuSoaEEQ5kxZ5e7SB/b/9ltIUlzfz6DxgTpAPhnMYGCmO1Y0UDBj3XQ== X-Received: by 2002:a05:6402:176c:: with SMTP id da12mr15795793edb.386.1600061309550; Sun, 13 Sep 2020 22:28:29 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1fb0f.dynamic.kabel-deutschland.de. [188.193.251.15]) by smtp.gmail.com with ESMTPSA id f4sm8251421edm.76.2020.09.13.22.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2020 22:28:29 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 Sep 2020 07:27:38 +0200 Message-Id: <20200914052747.124118-15-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200913025753.274772-1-andreas.rheinhardt@gmail.com> References: <20200913025753.274772-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 31/40] avcodec/cngenc: Cleanup generically after 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/cngenc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/cngenc.c b/libavcodec/cngenc.c index 8f23b7555a..b622d7bbda 100644 --- a/libavcodec/cngenc.c +++ b/libavcodec/cngenc.c @@ -58,10 +58,8 @@ static av_cold int cng_encode_init(AVCodecContext *avctx) return ret; p->samples32 = av_malloc_array(avctx->frame_size, sizeof(*p->samples32)); p->ref_coef = av_malloc_array(p->order, sizeof(*p->ref_coef)); - if (!p->samples32 || !p->ref_coef) { - cng_encode_close(avctx); + if (!p->samples32 || !p->ref_coef) return AVERROR(ENOMEM); - } return 0; } @@ -113,4 +111,5 @@ AVCodec ff_comfortnoise_encoder = { .close = cng_encode_close, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, };