From patchwork Mon Sep 14 05:27:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22350 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 EA5B544A49B for ; Mon, 14 Sep 2020 08:28:34 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CCC4468BB44; Mon, 14 Sep 2020 08:28:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f65.google.com (mail-ej1-f65.google.com [209.85.218.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 05F4368BB3C for ; Mon, 14 Sep 2020 08:28:33 +0300 (EEST) Received: by mail-ej1-f65.google.com with SMTP id r7so21299247ejs.11 for ; Sun, 13 Sep 2020 22:28:33 -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=uDDqtU6/fp1VlPqN/iXmZplB5Q5heO6Tpx5WNkDvs2o=; b=AGMPsIf1egRFa++lJj0gfjPgGKSmu1n73m41KRNAL4O4kJO7eDcGPglmcW1cpSSCvo y+SlbQfYuIH2WE03NzaZg8ZOQFoguf8H3fJYO8Fadabd445eVFp3UU+MdZq4Pz2xTldD uJHKXGKkx6utYjbbTRqSibIVZc5DTqZcGrmb4GCbfcyiXy67fby8miEuBxR1HeW9wQF2 DCbM6xw4SohK1GzAJ17UddjZxmUglqeW1UcM3dLNyhW4cq27Zx/HFMZarj5A7Uh9qAIr l0Iz5sfELf9JE7zsjhlgRJ7pqR61RtWii5asTMlYtE/UkxtwuW+hEJwEQQ5JSDx3dTE1 8o6g== 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=uDDqtU6/fp1VlPqN/iXmZplB5Q5heO6Tpx5WNkDvs2o=; b=Rfp3qpHyEiFYRItT3NH/vwPCHc7PisV3aG7dChV0Dx5Y3ZuXM8xc7dMD2GhDIHUMjC /35Q/CnqDpq916Egl8DVlhn5uGf3QQci7dbKbaAFv6Bxxhl64YkG0JtwdSF9APosFQrB fMIKOi6dzkdOF4idZFLKT2EvrrqlrCD+97h2Qnyk0rOJa4rWlWVxWeD+P6LeuoHUWHm+ tn3xmlOFnZa9LtjRR8228N0mSl0gY4g2J2JaLXWJ28Al0bVmtGu58ZR5EJ6buibAJPhj wFAYDYh0rha5rVfTlfbuepwdrtn0rYIZrQQEEEbdPIkGMQtbW8otMMBb/PD/flKUb3qD J7vw== X-Gm-Message-State: AOAM530Tqs9jssDdaCkKMNScg3mvM1JVvZ8FcUopohfQUK+ZaHit+fMT 5YE4ugtnb9uAcXj4avDpd83UmPFSzGo= X-Google-Smtp-Source: ABdhPJxttpeECiZfAk9qO7DJPOyfbOSvIbfcgmalwxYvk3nzl+laFpM4xOCCCVFlL4GCQ5IlpxWPfQ== X-Received: by 2002:a17:906:4d4d:: with SMTP id b13mr12541621ejv.221.1600061312423; Sun, 13 Sep 2020 22:28:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Sep 2020 22:28:31 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 14 Sep 2020 07:27:41 +0200 Message-Id: <20200914052747.124118-18-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 34/40] avcodec/ac3enc_template: Don't free uninitialized pointers on error 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 ac3 encoders (fixed- and floating-point AC-3 as well as the EAC-3 encoder) all allocate an array whose elements are pointers to other buffers. The array is not zeroed initially so that if an allocation of one of the subbuffers fails, the other pointers are uninitialized. This causes problems when cleaning, so zero the array initially. (Only the fixed-point AC-3 encoder was affected by this, because the other two don't clean up at all in case of errors during init.) Signed-off-by: Andreas Rheinhardt --- libavcodec/ac3enc_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c index 985b35e5b6..b85fe51ef5 100644 --- a/libavcodec/ac3enc_template.c +++ b/libavcodec/ac3enc_template.c @@ -42,7 +42,7 @@ int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s) int ch; if (!FF_ALLOC_TYPED_ARRAY(s->windowed_samples, AC3_WINDOW_SIZE) || - !FF_ALLOC_TYPED_ARRAY(s->planar_samples, s->channels)) + !FF_ALLOCZ_TYPED_ARRAY(s->planar_samples, s->channels)) return AVERROR(ENOMEM); for (ch = 0; ch < s->channels; ch++) {