From patchwork Mon Oct 21 02:49:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 15877 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 497B044A4B9 for ; Mon, 21 Oct 2019 05:50:10 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2B62068B015; Mon, 21 Oct 2019 05:50:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A98E268B008 for ; Mon, 21 Oct 2019 05:50:00 +0300 (EEST) Received: by mail-qk1-f196.google.com with SMTP id 4so11130405qki.6 for ; Sun, 20 Oct 2019 19:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=e5P1dVDVAjnxHA1jOeJB1w22a79i3n6d8PhgGY90qzY=; b=lVDmsSN9+yTonILLPvmLXbV/ed0tKuHQyOoyrqLfiSWaMVJ1LRk9fQcoKJmCCsehM5 Osov0HI+AORuu0ReivA/bMQ/4IK1pM5B51t8u5Duz//s3MoQCgfFQ4zfxXYoh25QoCFq ybrqFSgBJ0Ny36yyOdNnmg6g2CiGgRmWM5WBhTxobGkYzz8xzmjgPe41mHQ3ZJ42TYvo YO4cKztiWR/kZC+FD3VtGcuu6AnouRiwAWufKIOnRhsYCZAQgYcGV1z750vfkmyD6MRN /3H3qyYJ9+glQg877yTIxydVwIdg2oqaYy1VZAs1D1TIzM94ooKzwwWnSlPdKYQNWLjr rCPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e5P1dVDVAjnxHA1jOeJB1w22a79i3n6d8PhgGY90qzY=; b=ttImD2gM926frLj4YJ5R//D0GEpeuuHYArYp8uf+Rflc9ePOzXc4bj7jG2j7Migplj pJIES+knJywaAvl2duUVmWEykJEpNgd7Zp5bcdIu9TeDKYz/HYXYEJwiIp8hOhgbF+2b 3l9Zb9NGW8sPoQECdp7aGwJaEF47Ikiq9uyFyL1frTg0rt5gprj7kNO6KuIWzSTljGs5 H7nFc5GRQ9gfpiKe7CKK/t8GCbzzLlRk5rBTxX1iE15LSaX9SD15kS+vf8jyaOA36fvc uuElgsAHxhTgEL+gNbHzznXF+ThRvPPS32tQPP0p0Wf05nLs6SNO3ilpARvFwg2cWBGW SYzw== X-Gm-Message-State: APjAAAWurYvbEYPqBY+K/775vdn3JUVykj9FRqpYmLb20pIqkdxVpYK3 JjsBzzl7EoH+yVsr2SfgK+FVcXl8 X-Google-Smtp-Source: APXvYqxUbv220CrH4ClDq2m7PSu+HfXwzwOnhfKqo5UFSUnj/AOqD9FnAG2we2engqRWgx1JitoWcw== X-Received: by 2002:ae9:e802:: with SMTP id a2mr7193716qkg.159.1571626199374; Sun, 20 Oct 2019 19:49:59 -0700 (PDT) Received: from localhost.localdomain ([181.23.69.30]) by smtp.gmail.com with ESMTPSA id x8sm3101302qkl.78.2019.10.20.19.49.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 19:49:59 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Oct 2019 23:49:34 -0300 Message-Id: <20191021024934.1624-4-jamrial@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191021024934.1624-1-jamrial@gmail.com> References: <20191021024934.1624-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avformat/oggenc: free buffered page lists while uninitializing the muxer 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" If the trailer is never writen, there could be buffered pages that would leak. Signed-off-by: James Almer --- libavformat/oggenc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 06021c4f4b..77aa2518dc 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -740,6 +740,8 @@ static int ogg_write_trailer(AVFormatContext *s) static void ogg_free(AVFormatContext *s) { + OGGContext *ogg = s->priv_data; + OGGPageList *p = ogg->page_list; int i; for (i = 0; i < s->nb_streams; i++) { @@ -756,6 +758,12 @@ static void ogg_free(AVFormatContext *s) av_freep(&oggstream->header[1]); av_freep(&st->priv_data); } + + while (p) { + OGGPageList *next = p->next; + av_free(p); + p = next; + } } #if CONFIG_OGG_MUXER