From patchwork Tue Jul 21 02:12:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21213 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 CA24044B6A8 for ; Tue, 21 Jul 2020 05:12:47 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA48D68BB09; Tue, 21 Jul 2020 05:12:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 37BA768BAE8 for ; Tue, 21 Jul 2020 05:12:41 +0300 (EEST) Received: by mail-ed1-f66.google.com with SMTP id d18so14152643edv.6 for ; Mon, 20 Jul 2020 19:12:41 -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=CIRHd1yvN/Oh+azk8ZEfw+2mbYx+U/ykTlgww7Yu5oo=; b=HkoJFs+qDiaD6As4cc+shGcnir07a84CMLRKdmRIzzN4jVpDV+CMe90QUQtj4LG9ro 9dKULp7L156StNlgBwX6rSCt4j6YkNYhMoGyiEJ6PK2GgOQGuXivpDnPIixxYXB7QyAa Zj6SCC8zj0AbIAW98dpDfoLlCZtbXLwNJBgc01j6CGdiBMSBTl79EW9nhIJkRSYTUFYE TbVvQjtrsSOdRolOUwc4D5gtpKbFC3gsaygWN4Sagta3va+bJbW5z8q2yx3+3T5wW2av Hd3VJ4BG547xF9P0O/tk6MIMl0bXoTBDnVgFdENSoeTG9zkbRSn1HWI9vjQxcLP7r9D+ GGgQ== 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=CIRHd1yvN/Oh+azk8ZEfw+2mbYx+U/ykTlgww7Yu5oo=; b=ufePjDb1i4hhZfcWGf8HZ+AUPekm9gqBJnAxqmnxLJV5E8FAZYh4wLCMg8CtGTPFVq 0BJfaKc0jkLEgI/SLMkNR0f/vIXFzKry8VozK1ck/lLZjgEq4WW2vb0EaSUos1gDUuyD Npn7ZHX3ESQ1NhM8iSibIUZIGyHIs1z8rNKzKrGOjV/o1ENylrnG6DWWakW1N+QvEACg 7sroZjJ8sxJiaSdN6hwGXqVDKQwlqZbmG6hmGyrfkq4MWO4mWLH8BqvfOvYP2Q8YYaRh Utl0iTdyg4RGOptiT0qLHc73K8JBrHG4raE9GPhl+aDF5M7aRtj00cmdq0B8U4BlYxmX dnGw== X-Gm-Message-State: AOAM530lT81BzVpurwiTKU8iDg2EYRZc8dTrwgtomYAczAN0JhDO82x7 bzKCr86MofE+BZ+vtsRGVCwn7jUp X-Google-Smtp-Source: ABdhPJwlVbmPTVlqANAaKmcNg8SiNwhPtktQ3V7z0Y6So2EbhbxHj/skdHih/jCt2Sk1vP7jVqNfWg== X-Received: by 2002:aa7:dd05:: with SMTP id i5mr24229384edv.283.1595297560404; Mon, 20 Jul 2020 19:12:40 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 19:12:38 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Jul 2020 04:12:14 +0200 Message-Id: <20200721021215.32647-6-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 8/9] avformat/paf: 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. Signed-off-by: Andreas Rheinhardt --- libavformat/paf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libavformat/paf.c b/libavformat/paf.c index a31d01502b..9072c79edd 100644 --- a/libavformat/paf.c +++ b/libavformat/paf.c @@ -90,7 +90,6 @@ static int read_header(AVFormatContext *s) PAFDemuxContext *p = s->priv_data; AVIOContext *pb = s->pb; AVStream *ast, *vst; - int ret = 0; avio_skip(pb, 132); @@ -165,8 +164,7 @@ static int read_header(AVFormatContext *s) !p->video_frame || !p->audio_frame || !p->temp_audio_frame) { - ret = AVERROR(ENOMEM); - goto fail; + return AVERROR(ENOMEM); } avio_seek(pb, p->buffer_size, SEEK_SET); @@ -182,11 +180,6 @@ static int read_header(AVFormatContext *s) avio_seek(pb, p->start_offset, SEEK_SET); return 0; - -fail: - read_close(s); - - return ret; } static int read_packet(AVFormatContext *s, AVPacket *pkt) @@ -260,6 +253,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AVInputFormat ff_paf_demuxer = { .name = "paf", .long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File"), + .flags = AVFMT_HEADER_CLEANUP, .priv_data_size = sizeof(PAFDemuxContext), .read_probe = read_probe, .read_header = read_header,