Message ID | 20180422211822.12870-2-cus@passwd.hu |
---|---|
State | Accepted |
Commit | 649087fa83a50e04a4ddd7f2f5f740a18ac28902 |
Headers | show |
On 4/22/2018 6:18 PM, Marton Balint wrote: > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > libavdevice/decklink_dec.cpp | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp > index 10535dc388..510637676c 100644 > --- a/libavdevice/decklink_dec.cpp > +++ b/libavdevice/decklink_dec.cpp > @@ -475,16 +475,19 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) > > // Drop Packet if queue size is > maximum queue size > if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) { > + av_packet_unref(pkt); > av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); > return -1; > } > /* ensure the packet is reference counted */ > if (av_packet_make_refcounted(pkt) < 0) { > + av_packet_unref(pkt); > return -1; > } > > pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList)); > if (!pkt1) { > + av_packet_unref(pkt); > return -1; > } > av_packet_move_ref(&pkt1->pkt, pkt); This should be backported. Strictly speaking the last unref(), since pkt will always be reference counted at this point even before patch 1/2 of this series because of the make_refcounted() call above.
On Mon, 30 Apr 2018, James Almer wrote: > On 4/22/2018 6:18 PM, Marton Balint wrote: >> Signed-off-by: Marton Balint <cus@passwd.hu> >> --- >> libavdevice/decklink_dec.cpp | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp >> index 10535dc388..510637676c 100644 >> --- a/libavdevice/decklink_dec.cpp >> +++ b/libavdevice/decklink_dec.cpp >> @@ -475,16 +475,19 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) >> >> // Drop Packet if queue size is > maximum queue size >> if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) { >> + av_packet_unref(pkt); >> av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); >> return -1; >> } >> /* ensure the packet is reference counted */ >> if (av_packet_make_refcounted(pkt) < 0) { >> + av_packet_unref(pkt); >> return -1; >> } >> >> pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList)); >> if (!pkt1) { >> + av_packet_unref(pkt); >> return -1; >> } >> av_packet_move_ref(&pkt1->pkt, pkt); > > This should be backported. Strictly speaking the last unref(), since pkt > will always be reference counted at this point even before patch 1/2 of > this series because of the make_refcounted() call above. Indeed, backported. Thanks, Marton
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 10535dc388..510637676c 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -475,16 +475,19 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) // Drop Packet if queue size is > maximum queue size if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) { + av_packet_unref(pkt); av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); return -1; } /* ensure the packet is reference counted */ if (av_packet_make_refcounted(pkt) < 0) { + av_packet_unref(pkt); return -1; } pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList)); if (!pkt1) { + av_packet_unref(pkt); return -1; } av_packet_move_ref(&pkt1->pkt, pkt);
Signed-off-by: Marton Balint <cus@passwd.hu> --- libavdevice/decklink_dec.cpp | 3 +++ 1 file changed, 3 insertions(+)