diff mbox

[FFmpeg-devel] avcodec/librav1e: free the RaPacket after using it

Message ID 20191111011906.5466-1-jamrial@gmail.com
State Accepted
Commit 3a84081cbd982ce1bd9456eca5b1b03cd495e0fe
Headers show

Commit Message

James Almer Nov. 11, 2019, 1:19 a.m. UTC
Fixes leaks.

Signed-off-by: James Almer <jamrial@gmail.com>
---
Missed this detail when reviewing. It's a remnant of the version where the
RaPacket was attached to the AVPacket.

 libavcodec/librav1e.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Derek Buitenhuis Nov. 11, 2019, 1:21 a.m. UTC | #1
On 11/11/2019 01:19, James Almer wrote:
> Fixes leaks.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> Missed this detail when reviewing. It's a remnant of the version where the
> RaPacket was attached to the AVPacket.

Woops, yeah. I remember /thinking/ I needed too and then forgot.

LGTM.

- Derek
James Almer Nov. 11, 2019, 1:35 a.m. UTC | #2
On 11/10/2019 10:21 PM, Derek Buitenhuis wrote:
> On 11/11/2019 01:19, James Almer wrote:
>> Fixes leaks.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> Missed this detail when reviewing. It's a remnant of the version where the
>> RaPacket was attached to the AVPacket.
> 
> Woops, yeah. I remember /thinking/ I needed too and then forgot.
> 
> LGTM.
> 
> - Derek

Pushed, thanks.
diff mbox

Patch

diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index f65d784127..5052cac896 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -508,12 +508,12 @@  retry:
         pkt->flags |= AV_PKT_FLAG_KEY;
 
     pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame;
+    rav1e_packet_unref(rpkt);
 
     if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
         int ret = av_bsf_send_packet(ctx->bsf, pkt);
         if (ret < 0) {
             av_log(avctx, AV_LOG_ERROR, "extradata extraction send failed.\n");
-            rav1e_packet_unref(rpkt);
             av_packet_unref(pkt);
             return ret;
         }
@@ -521,7 +521,6 @@  retry:
         ret = av_bsf_receive_packet(ctx->bsf, pkt);
         if (ret < 0) {
             av_log(avctx, AV_LOG_ERROR, "extradata extraction receive failed.\n");
-            rav1e_packet_unref(rpkt);
             av_packet_unref(pkt);
             return ret;
         }