avcodec/librav1e: free the RaPacket after using it
authorJames Almer <jamrial@gmail.com>
Mon, 11 Nov 2019 01:15:44 +0000 (22:15 -0300)
committerJames Almer <jamrial@gmail.com>
Mon, 11 Nov 2019 01:31:42 +0000 (22:31 -0300)
Fixes leaks.

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/librav1e.c

index f65d784..5052cac 100644 (file)
@@ -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;
         }