Browse Source

avformat/utils: optimize ff_packet_list_free()

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

Signed-off-by: James Almer <jamrial@gmail.com>
tags/n4.0
James Almer 8 years ago
parent
commit
58ce4fdeae
1 changed files with 6 additions and 3 deletions
  1. +6
    -3
      libavformat/utils.c

+ 6
- 3
libavformat/utils.c View File

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