diff options
author | James Almer <jamrial@gmail.com> | 2018-03-26 15:02:36 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2018-04-04 00:15:38 -0300 |
commit | 58ce4fdeaebce5d9837ebc77e1453e7cf3a5bb1d (patch) | |
tree | 3e54f1b6af8a5d13f66b5ec85eeb851d0e5efe33 /libavformat | |
parent | 3a4d74c1fff8a1c2691ebf0532aa283ca9b4d0d9 (diff) | |
download | ffmpeg-58ce4fdeaebce5d9837ebc77e1453e7cf3a5bb1d.tar.gz |
avformat/utils: optimize ff_packet_list_free()
Don't constantly overwrite the list's head pointer.
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index be9a44f168..3e482a3bbc 100644 --- a/libavformat/utils.c +++ b/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; } |