diff mbox

[FFmpeg-devel] lavc/vorbisdec: Allow avcodec_open2 to call .close

Message ID CAADho6PhkdU7dNQf88DMo42B=sMeSABsNo0ta=9k2NC_Og=k4Q@mail.gmail.com
State New
Headers show

Commit Message

Matthew Wolenetz March 6, 2018, 12:43 a.m. UTC

Comments

Michael Niedermayer March 7, 2018, 6:50 p.m. UTC | #1
On Mon, Mar 05, 2018 at 04:43:56PM -0800, Matthew Wolenetz wrote:
> 

>  vorbisdec.c |    1 +
>  1 file changed, 1 insertion(+)
> ade25a35093139e9555c2a6563e950e31c150697  0001-lavc-vorbisdec-Allow-avcodec_open2-to-call-.close.patch
> From 7471c1d223b860c13793abfd93174d1557f77d6f Mon Sep 17 00:00:00 2001
> From: Matt Wolenetz <wolenetz@chromium.org>
> Date: Mon, 5 Mar 2018 15:59:18 -0800
> Subject: [PATCH] lavc/vorbisdec: Allow avcodec_open2 to call .close
> 
> If there is a decoder initialization failure detected in avcodec_open2
> after .init is called, allow graceful decoder .close to prevent leaking
> vorbis decoder allocations such as those from vorbis_parse_setup_*.
> 
> BUG=772699
> ---
>  libavcodec/vorbisdec.c | 1 +
>  1 file changed, 1 insertion(+)

will apply

thx

[...]
diff mbox

Patch

From 7471c1d223b860c13793abfd93174d1557f77d6f Mon Sep 17 00:00:00 2001
From: Matt Wolenetz <wolenetz@chromium.org>
Date: Mon, 5 Mar 2018 15:59:18 -0800
Subject: [PATCH] lavc/vorbisdec: Allow avcodec_open2 to call .close

If there is a decoder initialization failure detected in avcodec_open2
after .init is called, allow graceful decoder .close to prevent leaking
vorbis decoder allocations such as those from vorbis_parse_setup_*.

BUG=772699
---
 libavcodec/vorbisdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 2a4f482031..00e9cd8a13 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1862,6 +1862,7 @@  AVCodec ff_vorbis_decoder = {
     .decode          = vorbis_decode_frame,
     .flush           = vorbis_decode_flush,
     .capabilities    = AV_CODEC_CAP_DR1,
+    .caps_internal   = FF_CODEC_CAP_INIT_CLEANUP,
     .channel_layouts = ff_vorbis_channel_layouts,
     .sample_fmts     = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
                                                        AV_SAMPLE_FMT_NONE },
-- 
2.16.2.395.g2e18187dfd-goog