[FFmpeg-devel] FW: RFQ on patch for decklink warnings
Felt, Patrick
Patrick.Felt at sling.com
Mon May 29 17:58:56 EEST 2017
bump
From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> on behalf of "ffmpeg-devel-bounces at ffmpeg.org" <ffmpeg-devel-bounces at ffmpeg.org>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
Date: Tuesday, May 23, 2017 at 4:06 PM
To: FFmpeg development discussions and patches <ffmpeg-devel at 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.
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;
pthread_mutex_lock(&q->mutex);
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org<mailto:ffmpeg-devel at ffmpeg.org>
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list