From patchwork Tue Mar 6 21:56:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7832 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.181.170 with SMTP id m39csp4260290jaj; Tue, 6 Mar 2018 13:56:46 -0800 (PST) X-Google-Smtp-Source: AG47ELvel7KW0oqTqsoZxW5xXFCz6lrOhVuoHp98h6WJK8EKOoEzJaHK+qmR1UM5+gTAwzSGxzA9 X-Received: by 10.28.14.6 with SMTP id 6mr13579482wmo.2.1520373406352; Tue, 06 Mar 2018 13:56:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520373406; cv=none; d=google.com; s=arc-20160816; b=hTm4mUydn2IZ2nhPbDZQ3RfYCyr40bF0wBJuroUj3n6Mxr8efQiLdTFQFHsZ5SSV/B WaKw48XI9R2JKpfY6CgADw1MO8lBHzmNtLuS0xA0YlDpTyb0FIPykIq/abwtVdnUaCl6 UZIjx6jiI/i5/AekaMrYbZMZUFPt2A9J2GHaK00DVdJmdp4MlCexqNnD59FiKOfSq4ci zTbp0zaROFD895nWh/Zq0JVIWDgSRx4ejEmEtPrijsMYniEnoYYW/CPQhHj62N4Q1HsD goRUwRsj+yoXCAkhlxRU4lc81awXXsP2zFpCCztoJAO7xn5DXKuk33nDAEIisJt1f4MM od7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=RYL2CaX7IMbESMXkzZ43nh5qNasfXUg4hbqGsi4Td3Q=; b=yCDZWShCo67DMgdvAc/PmqXS2RZY3+NUAgQ34shZIR/3PvkJQSRjKF564mEY0OIqov mwYK+WhNBX3HZ2lzYvaUmdp6RapZSIfRRnZVLEX3ROXCYpqO+Vwh712MryMelOaM4OPF 9UnlKyKSaS3ZzugOzKVFGOXe/uzHDO2W8KCAJ05ZKaZFeALzKuxlO9msTlV2/Yd9UAQ1 W44yGeaGCk6d4U+VyG1au6O2jOIzntHYi8fK8+ORCa84XDIDcDbLR+FlOD0crvcxUM7h hpYZNpyM3toP1x12ZimfKWcTiXBqzP3PkthrfQBicpu6PZKw+W1jFJip4RgQD+JmlFZ1 wCmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n81si12114559wrb.68.2018.03.06.13.56.45; Tue, 06 Mar 2018 13:56:46 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8907A68A3C9; Tue, 6 Mar 2018 23:56:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe03-3.mx.upcmail.net (vie01a-dmta-pe03-3.mx.upcmail.net [62.179.121.162]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0370968A1FD for ; Tue, 6 Mar 2018 23:56:25 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1etKZU-0005By-Ov for ffmpeg-devel@ffmpeg.org; Tue, 06 Mar 2018 22:56:32 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id JlwV1x01D0S5wYM01lwWGF; Tue, 06 Mar 2018 22:56:30 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 6 Mar 2018 22:56:23 +0100 Message-Id: <20180306215623.26344-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306215623.26344-1-michael@niedermayer.cc> References: <20180306215623.26344-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 2/2] avformat/oggdec: Fix metadata memleak on multiple headers 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: Chromium bug 800123 Reported-by: Matt Wolenetz Reviewed-by: Matt Wolenetz Signed-off-by: Michael Niedermayer --- libavformat/oggdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 38f60653f9..27d16a3e4e 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -128,7 +128,10 @@ static int ogg_restore(AVFormatContext *s) ogg->state = ost->next; for (i = 0; i < ogg->nstreams; i++) { - av_freep(&ogg->streams[i].buf); + struct ogg_stream *stream = &ogg->streams[i]; + av_freep(&stream->buf); + av_freep(&stream->new_metadata); + if (i >= ost->nstreams || !ost->streams[i].private) { free_stream(s, i); }