From patchwork Sun Jun 14 22:36:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20374 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 F19A644A534 for ; Mon, 15 Jun 2020 01:41:15 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB39568B6F2; Mon, 15 Jun 2020 01:41:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EF3BF68B68B for ; Mon, 15 Jun 2020 01:41:09 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id j10so15166492wrw.8 for ; Sun, 14 Jun 2020 15:41:09 -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=EmZCwcV0Ai9E6ot03Kkc8KtT3aWTU2k6+1kVHlpdrsA=; b=I/Y/D1/7Iz3ITq9/OjSLiCjXqxXEes10ykOJXf7ELfaDNxwzyPCD4SU2ZFpGMQcEi3 vdIGsyH7iyErBD+MTYgKgxILOoqnk0vfpfqWlfZhwMCUWj3Eg7i1s3Zmmlt8EyYzEMl2 GycjFPCDaTzzco4NU/uHuRdldpR0MYprbTszwzaW8j9WsyFKwjl9pEEA3utIrt03cuHX KK8TDD8XIm6cXFdJGoDcS1skCl5k3jlpJyWsBUfpc4/8yZ1M2DIBVVFlnJP8LE/BEJun yMGOu7kbN3gUqsPtqsgMNPV73PabTX8upPSRCc0x13x/HGv2GDTkbfTUIyD1IW/gf4tV t2Cg== 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=EmZCwcV0Ai9E6ot03Kkc8KtT3aWTU2k6+1kVHlpdrsA=; b=bryTPcwtkl/Xxlz021hC71rHamSU/wXOOaZsslJcZB+qjtsfi02Lcx3jjFwU3aa2Cr UO4S0m/wexF60JzJfunlFXzIxk7YhtSjPFLKCSIhrfk8PZ7VyY0WdTnCb6Lx64xEKoFo 7UQyTazFbJtX5OfJrusslU+WmRycGRaAIJwE834IyD1Zs54vA9cv/9eGdtKLFlh7gmO9 kk3pFR4HTmnIftlbmjAsgXtACWg59iZhU4Ks19ioVhUmCvDjSr646ZM6rE66QVVdvLaL HbEr1h8lDPmwawfaKpQpNS7ATNr4dyxEvOIxdzWT2kkz4rEhpsK0syepp1gnfGCwGHsY Hjtw== X-Gm-Message-State: AOAM532ScruN55FTU48kueH9DCJ0wdyVmfDcAcw//scmSXb+n0W7yZPv JHi1JU0oZiG6HrQ/Fgar7Q0fE4i5 X-Google-Smtp-Source: ABdhPJyynkwHY4i4+JYOOPmgp4sWIFkevgVCaWUsJ66T6Xk49z2BEnymjvjQuIgGD4xJHYuAMIq5Mw== X-Received: by 2002:adf:9544:: with SMTP id 62mr24871134wrs.32.1592174469106; Sun, 14 Jun 2020 15:41:09 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id z8sm21491034wru.33.2020.06.14.15.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 15:41:08 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jun 2020 00:36:53 +0200 Message-Id: <20200614223656.21338-23-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> References: <20200614223656.21338-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 23/26] avformat/webvttdec: Fix memleak upon 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" The already parsed subtitles (contained in an FFDemuxSubtitlesQueue) would leak if an error happened upon reading a subsequent subtitle. Signed-off-by: Andreas Rheinhardt --- libavformat/webvttdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c index 6c4d5f6736..bd3d45b382 100644 --- a/libavformat/webvttdec.c +++ b/libavformat/webvttdec.c @@ -164,6 +164,8 @@ static int webvtt_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &webvtt->q); end: + if (res < 0) + ff_subtitles_queue_clean(&webvtt->q); av_bprint_finalize(&cue, NULL); return res; }