From patchwork Tue Jul 21 02:12:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21214 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 CFA1B44B6A8 for ; Tue, 21 Jul 2020 05:12:49 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AAE3868BAF5; Tue, 21 Jul 2020 05:12:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8FC7768BB06 for ; Tue, 21 Jul 2020 05:12:42 +0300 (EEST) Received: by mail-ed1-f65.google.com with SMTP id z17so14163566edr.9 for ; Mon, 20 Jul 2020 19:12:42 -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=D26pvtVY4EFMK1BCKHCAnxrDK79oMozIKv3Dh5AsnpY=; b=Zpap7GJhsY5YkMfZbiq0UnV4WXUEvVFZc5mwmFf8DuJdcCKueVDv5QWc8dmebtqTNZ qG+oGR/jxqxsE0QQMOscGNoUeL0W2NeyrqEVsLceOIUs0P4ekHqniBderl2UPJ9KLtX4 BT4dvpAQhCz4l4qK6ryr0fC+Cvoq9mubGbhogLqcavl68CUTFMh5mqGdFFwhIz5iTcEe 4PfcFRYP++iLn8btw6D3ijzDiBOwHEcfB6epajKdOOE11i4yUWaLuf2EH6/AIIaGQI1q pK+kqg8SjJxgcZYimkf2Y+iidPfbe+ZFJ/XJVTj73VwKymLkHaTsDvoH4TL/X2ATleQr sYKQ== 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=D26pvtVY4EFMK1BCKHCAnxrDK79oMozIKv3Dh5AsnpY=; b=eNbtJ1S4A93UWylJWreWE9jdcTB5BXkDQOZKrinGPKEBx+wm8TEwFfnb+w8Yaqbtvm 4Bd9Nc2lPCCVSw9XhFXNcbw7z/n3tF8DGK90kI0hp6PNAs1P2xkQfoA+dhLPPDJawzBu 0i93AiTB9wEanTNO2Ua+86iCTm9i7oOYrYaAVydlPKtzYbIzEUEBIlrSTd4bkp4381/w fsgqsrOzhT/Xmu6Ao8vgxMYzpi0eE+nQ0fKP/2CiW90RiybfU/v54HF9mosexVDRlCl/ bULBj1hP2jy5UFGhKe8i9o4JGYwxMFaQCTVRCSaeQwTD3vZfcaeVPkYfeY3Cil9DqXZD ASHg== X-Gm-Message-State: AOAM5326dcg0bttQeWJSdPjACHHhUYyUPR1M1d51a6yO7mIzPHoLlmHu eW+jxlvBNEB5wcsp2mK9IErpBcJF X-Google-Smtp-Source: ABdhPJy9cKAyIwyzEq+HMdMb951CjBuYcBzf6ZmBxJzc1+x96arMLzvLxcntVzTmDspKxvIZ3t/D2Q== X-Received: by 2002:a50:f0c6:: with SMTP id a6mr23282639edm.374.1595297561670; Mon, 20 Jul 2020 19:12:41 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc10296.dynamic.kabel-deutschland.de. [188.193.2.150]) by smtp.gmail.com with ESMTPSA id p9sm15528563ejd.50.2020.07.20.19.12.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 19:12:40 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Jul 2020 04:12:15 +0200 Message-Id: <20200721021215.32647-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200719204755.32269-1-andreas.rheinhardt@gmail.com> References: <20200719204755.32269-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 9/9] avformat/concatdec: Simplify cleanup after read_header 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" by setting the AVFMT_HEADER_CLEANUP flag. (Btw: concat_read_close() is not idempotent (it frees cat->files, but doesn't reset cat->nb_files), so this demuxer was incompatible with simply calling read_close generically upon read_header failure.) Signed-off-by: Andreas Rheinhardt --- libavformat/concatdec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 4b56b61404..5f3c63a621 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -510,12 +510,9 @@ static int concat_read_header(AVFormatContext *avf) MATCH_ONE_TO_ONE; if ((ret = open_file(avf, 0)) < 0) goto fail; - av_bprint_finalize(&bp, NULL); - return 0; fail: av_bprint_finalize(&bp, NULL); - concat_read_close(avf); return ret; } @@ -778,6 +775,7 @@ static const AVClass concat_class = { AVInputFormat ff_concat_demuxer = { .name = "concat", .long_name = NULL_IF_CONFIG_SMALL("Virtual concatenation script"), + .flags = AVFMT_HEADER_CLEANUP, .priv_data_size = sizeof(ConcatContext), .read_probe = concat_probe, .read_header = concat_read_header,