Commit 58ce4fde authored by James Almer's avatar James Almer

avformat/utils: optimize ff_packet_list_free()

Don't constantly overwrite the list's head pointer.
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 3a4d74c1
......@@ -1416,12 +1416,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
void ff_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
{
while (*pkt_buf) {
AVPacketList *pktl = *pkt_buf;
*pkt_buf = pktl->next;
AVPacketList *tmp = *pkt_buf;
while (tmp) {
AVPacketList *pktl = tmp;
tmp = pktl->next;
av_packet_unref(&pktl->pkt);
av_freep(&pktl);
}
*pkt_buf = NULL;
*pkt_buf_end = NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment