From patchwork Sun Jun 14 22:36:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 20370 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 1FEE14491DC for ; Mon, 15 Jun 2020 01:39:45 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 08B5468B5BF; Mon, 15 Jun 2020 01:39:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 581AC68B129 for ; Mon, 15 Jun 2020 01:39:43 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id l17so12813118wmj.0 for ; Sun, 14 Jun 2020 15:39:43 -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=cpfKrVcD8NgWPBoK0FA9rnqN7oH4YH+n93tKDxliV+Y=; b=FaHJj4UNIQHM9q68Ol5Lx1gSy+8LiydKtznHwWQB7/ieA58tv4BteCQjycrUNjINat J0tmZyedbIxQNoGo2EAaE6HhFNxVeWxV5ffk84jqpojwYF4p2LUbZ2kjAexAgTwQ7Z4K Ce0rIT3M4PTK+HS0QND7Wc6rPAoYBptGfnjMNhddqN+a/cYudZ0C7UQayN2nzXtXBkIY PxhWMeNp1DK1aQQcm37G8TSA4NvCH1Q5mwcLaFKaIJLC3V86WlxTsKHMKPW01J3MJDxo ehVMdxdF61XExxTkaWfCIS2gwGwfX4kCBQ4srQLEeRTJeDtPuBEWI8cJzMtnknD0bKnE AyYQ== 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=cpfKrVcD8NgWPBoK0FA9rnqN7oH4YH+n93tKDxliV+Y=; b=WTpbUBI9SFOjFedRV6TJqs7lM1PF+NFtllK+yd8yEJst5qlNGuopwrmr9aibr4PsbW 9Y4H2xA3LMKfYnyYxYYBdVegsMzUJVHD6CarVeCIX7FTYC35W4qHN2gfRofcNpgVds/r 9HFo6gKt8VlitFt8vu1uyTPQG240L8N7gwmhuLWcINoaQiu293H8g4WV5G6UWIYU+pMo Kgxx5kkJ1RdWKDpvVWZSva1lMEU1v9+GH0+3DJxy/RFtjNI2aXYg7X2TNKYjDu/PhJw3 SLXPjO1ReHPQ3YBO95i68spIMHMtYTcWUyoIKXfshB9segTwevLQUfeCt6yPT4O7xIpB sVUA== X-Gm-Message-State: AOAM530ZtIsiGH+dMDodJMPgf0hUZSGTL4OEvxaqysw6VNlGg1XEuyH0 easLd3Cf2q7fyX1k0M1I+4m/RmaB X-Google-Smtp-Source: ABdhPJxQN/6FxA7ATp7D7aGRY04zJ0ydwWMz97nP7rb+jTde7TNCBWB3Zwkg2tlwg5HvTiTkqvptfw== X-Received: by 2002:a1c:c302:: with SMTP id t2mr9686606wmf.72.1592174382379; Sun, 14 Jun 2020 15:39:42 -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.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 15:39:41 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jun 2020 00:36:49 +0200 Message-Id: <20200614223656.21338-19-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 19/26] avformat/subviewer1dec: 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/subviewer1dec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/subviewer1dec.c b/libavformat/subviewer1dec.c index 1360d9b7d9..f2eee294a1 100644 --- a/libavformat/subviewer1dec.c +++ b/libavformat/subviewer1dec.c @@ -77,8 +77,10 @@ static int subviewer1_read_header(AVFormatContext *s) sub->duration = pts_start - sub->pts; } else { sub = ff_subtitles_queue_insert(&subviewer1->q, line, len, 0); - if (!sub) + if (!sub) { + ff_subtitles_queue_clean(&subviewer1->q); return AVERROR(ENOMEM); + } sub->pos = pos; sub->pts = pts_start; sub->duration = -1;