You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avformat/utils: optimize ff_packet_list_free()
Don't constantly overwrite the list's head pointer. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -1416,12 +1416,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
|
|
||||||
void ff_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
|
void ff_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
|
||||||
{
|
{
|
||||||
while (*pkt_buf) {
|
AVPacketList *tmp = *pkt_buf;
|
||||||
AVPacketList *pktl = *pkt_buf;
|
|
||||||
*pkt_buf = pktl->next;
|
while (tmp) {
|
||||||
|
AVPacketList *pktl = tmp;
|
||||||
|
tmp = pktl->next;
|
||||||
av_packet_unref(&pktl->pkt);
|
av_packet_unref(&pktl->pkt);
|
||||||
av_freep(&pktl);
|
av_freep(&pktl);
|
||||||
}
|
}
|
||||||
|
*pkt_buf = NULL;
|
||||||
*pkt_buf_end = NULL;
|
*pkt_buf_end = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user