diff mbox

[FFmpeg-devel] FW: RFQ on patch for decklink warnings

Message ID 47BFF55A-B4C8-469D-9120-11014441BA0F@dish.com
State New
Headers show

Commit Message

Felt, Patrick May 29, 2017, 2:58 p.m. UTC

From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> on behalf of "ffmpeg-devel-bounces@ffmpeg.org" <ffmpeg-devel-bounces@ffmpeg.org>

Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Date: Tuesday, May 23, 2017 at 4:06 PM
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] RFQ on patch for decklink warnings

Afternoon all,
  I’m looking at fixing some warnings on deprecated api calls in the decklink drivers.  I’ve got a patch ready, but it looks like I might be leaking memory somewhere. In the old code using the av_dup_packet() is a free() of some kind required in code that I might be able to look for and unref() ?

Here is the current patch, not looking for a commit on it, just discussion in what I’m missing.

ffmpeg-devel mailing list
diff mbox


diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 39974e3..47cef29 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -122,16 +122,16 @@  static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt)
         av_log(q->avctx, AV_LOG_WARNING,  "Decklink input buffer overrun!\n");
         return -1;
-    /* duplicate the packet */
-    if (av_dup_packet(pkt) < 0) {
+    pkt1 = (AVPacketList *)av_mallocz(sizeof(AVPacketList));
+    if (!pkt1) {
         return -1;

-    pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList));
-    if (!pkt1) {
+    /* duplicate the packet */
+    if (av_packet_ref(&pkt1->pkt, pkt) < 0) {
         return -1;
-    pkt1->pkt  = *pkt;
     pkt1->next = NULL;