]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/encode.c
avcodec/g2meet: Check RGB upper limit
[ffmpeg] / libavcodec / encode.c
index 71b1b14afc029dfb5ea61afc22a668bbc0b02e46..d9761515aa84e2ccdf5040fdabd6fb9af310bc4f 100644 (file)
@@ -223,12 +223,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
             avpkt->buf      = user_pkt.buf;
             avpkt->data     = user_pkt.data;
         } else if (!avpkt->buf) {
-            AVPacket tmp = { 0 };
-            ret = av_packet_ref(&tmp, avpkt);
-            av_packet_unref(avpkt);
+            ret = av_packet_make_refcounted(avpkt);
             if (ret < 0)
                 goto end;
-            *avpkt = tmp;
         }
     }
 
@@ -318,12 +315,9 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
             avpkt->buf      = user_pkt.buf;
             avpkt->data     = user_pkt.data;
         } else if (!avpkt->buf) {
-            AVPacket tmp = { 0 };
-            ret = av_packet_ref(&tmp, avpkt);
-            av_packet_unref(avpkt);
+            ret = av_packet_make_refcounted(avpkt);
             if (ret < 0)
                 return ret;
-            *avpkt = tmp;
         }
     }