avformat/utils: optimize ff_packet_list_free()

Don't constantly overwrite the list's head pointer.

Signed-off-by: James Almer <jamrial@gmail.com>
pull/283/head
James Almer 7 years ago
parent 3a4d74c1ff
commit 58ce4fdeae
  1. 9
      libavformat/utils.c

@ -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;
}

Loading…
Cancel
Save