From patchwork Sat Sep 26 10:27:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22612 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 EC53E44A10F for ; Sat, 26 Sep 2020 13:30:17 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D093068B7CB; Sat, 26 Sep 2020 13:30:17 +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 C439968B751 for ; Sat, 26 Sep 2020 13:30:14 +0300 (EEST) Received: by mail-wr1-f66.google.com with SMTP id s12so6595313wrw.11 for ; Sat, 26 Sep 2020 03:30:14 -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=smVFEK2cY57DuFqiSXq42jt+GsOuT0W66WFyDxYQX5k=; b=VfxqwdhW33i2Qb8QGw8O7rwYdDVfuHpQN8ZvDkNnJ03qhfgV7jHacTUc3Mcjxo4RlN sQ1UZpbzd86XzI7oYYa6r676qRcozzyEiiFrykzYUt+T97Ksc86E/GdagpwMPDBCOiux QUbBmVyl3Y8L3CyNdR+sEVgUpVp0OKMLKX3zHOZEcYrsBHc8xVB9FjYDl/7q2Hlt8p76 tZfPKZ9sqpWNYlve8b04gVYByyJnX7sR1rJwf33i3E6S4U5W8LPYZoAYi0s+6uEuapQv 9veENpDdsx3GDQmDUbIcJvy3tvwp5wzll2oV+TMxcXGjZlzyh7QRfuCitvLmfNoGLHF0 gTLA== 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=smVFEK2cY57DuFqiSXq42jt+GsOuT0W66WFyDxYQX5k=; b=Z5r8GdrkNgJG8k9dr577LN6gvybAWydsK4gpRUxLLMQ2QzfJnzoNFbpX2nfd7XM7NW ZCgLyq0joEOqk7lYJoaFYb0OPwnTnKB8T8oyQmYHvPghc2aV+/dijfhut/24NNUM0ABy HAIdWF9ktRYlKUYzqa2gsaz+TUBWsqNzUOLYv5T3pgWz3GY8BGGF91DGQHL7+35GwzWI 0dCtZqcm+Ul8UkediGHf/22/TthrEkrurPHskhLfdMpKolbFZbHOlhA/stzqET+DQVae tdkohMUhnRVA/suHLa874ceh/gseH1T3m21uz7S2e0shjFnUq/Z1Lo5CKsq5QrctqSvL oNqg== X-Gm-Message-State: AOAM533wEjjG5w9+rz0eqUQ+MxZigMPbSUkaOKmZbH3jB3YSjnbfh1WI jYVCvFoo6xM3ltPnQ7AqsJbq6Gy8D6k= X-Google-Smtp-Source: ABdhPJyNbE/1Ddliy0xnoLS/Ml6G5GxaBXuCmcpwrhr2Gh30wl0vRUurcHKo8mPCaNMQr4Mq//EFRw== X-Received: by 2002:adf:c5c3:: with SMTP id v3mr9221613wrg.205.1601116213752; Sat, 26 Sep 2020 03:30:13 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k8sm6064867wrl.42.2020.09.26.03.30.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 03:30:12 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Sep 2020 12:27:58 +0200 Message-Id: <20200926102804.228089-19-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> References: <20200926102804.228089-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/25] avcodec/utils: Remove always-true check 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 first thing avcodec_open2() allocates is the AVCodecInternal. If allocating it fails, a jump to end occurs; but if an error happens after its allocation, a jump to free_and_end happens which frees all allocations performed so far and then jumps to end. Yet free_and_end contained a check for AVCodecInternal (after having already dereferenced it to check whether ff_thread_free() needs to be called) which is of course always true. So remove it. Signed-off-by: Andreas Rheinhardt --- libavcodec/utils.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 94b9e94584..8e7c3125aa 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1043,7 +1043,7 @@ FF_ENABLE_DEPRECATION_WARNINGS av_dict_free(&tmp); av_freep(&avctx->priv_data); av_freep(&avctx->subtitle_header); - if (avci) { + av_frame_free(&avci->to_free); av_frame_free(&avci->compat_decode_frame); av_frame_free(&avci->buffer_frame); @@ -1056,7 +1056,6 @@ FF_ENABLE_DEPRECATION_WARNINGS av_bsf_free(&avci->bsf); av_buffer_unref(&avci->pool); - } av_freep(&avci); avctx->internal = NULL; avctx->codec = NULL;