diff mbox series

[FFmpeg-devel,07/10] avcodec/libdav1d: Don't leak side-data-only packets

Message ID AM7PR03MB6660F0CF3D76861197FFACD68FB59@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 776e9f9e2af40252c93e150be712f848d562fccf
Headers show
Series [FFmpeg-devel,01/10] avcodec/binkaudio: Remove AV_CODEC_CAP_DELAY | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 11, 2021, 3:36 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/libdav1d.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

James Almer Oct. 15, 2021, noon UTC | #1
On 10/11/2021 12:36 PM, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>   libavcodec/libdav1d.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index 2807210e50..2d5fccec71 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -328,6 +328,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
>                       return res;
>                   }
>               }
> +        } else if (res >= 0) {
> +            av_packet_unref(&pkt);
> +            return AVERROR(EAGAIN);

Not exactly a real world scenario, but a valid one, so nice catch and lgtm.

>           }
>       }
>   
>
diff mbox series

Patch

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 2807210e50..2d5fccec71 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -328,6 +328,9 @@  static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
                     return res;
                 }
             }
+        } else if (res >= 0) {
+            av_packet_unref(&pkt);
+            return AVERROR(EAGAIN);
         }
     }