diff mbox series

[FFmpeg-devel,2/2] avfilter/vf_uspp: Fix leak of packet side data

Message ID 20210312142407.2034015-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 6e2db67801c9975fae6f55c40f615d87b9a74a15
Headers show
Series [FFmpeg-devel,1/2] avfilter/vf_uspp: Fix leak of qp-table on error | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt March 12, 2021, 2:24 p.m. UTC
The uspp filter uses a special option ("no_bitstream") of
the Snow encoder to suppress it from generating output.
The filter therefore did not unref the packet after usage,
believing it to be blank. But this is wrong, as the Snow encoder
attaches quality stats side data to the packet.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
If there were a fate test for this filter, this would have been found
and fixed long ago.

 libavfilter/vf_uspp.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Niedermayer March 12, 2021, 5:24 p.m. UTC | #1
On Fri, Mar 12, 2021 at 03:24:07PM +0100, Andreas Rheinhardt wrote:
> The uspp filter uses a special option ("no_bitstream") of
> the Snow encoder to suppress it from generating output.
> The filter therefore did not unref the packet after usage,
> believing it to be blank. But this is wrong, as the Snow encoder
> attaches quality stats side data to the packet.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---

LGTM


> If there were a fate test for this filter, this would have been found
> and fixed long ago.



[...]
diff mbox series

Patch

diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c
index b77edeb244..523e47c811 100644
--- a/libavfilter/vf_uspp.c
+++ b/libavfilter/vf_uspp.c
@@ -257,6 +257,7 @@  static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3],
             av_log(p->avctx_enc[i], AV_LOG_ERROR, "Encoding failed\n");
             continue;
         }
+        av_packet_unref(&pkt);
 
         p->frame_dec = p->avctx_enc[i]->coded_frame;