Commit 34c9c1ba authored by Aurelien Jacobs's avatar Aurelien Jacobs

move internal queue freeing code in its own function

Originally committed as revision 11350 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b3d8c2c4
......@@ -846,6 +846,23 @@ matroska_queue_packet (MatroskaDemuxContext *matroska,
matroska->num_packets++;
}
/*
* Free all packets in our internal queue.
*/
static void
matroska_clear_queue (MatroskaDemuxContext *matroska)
{
if (matroska->packets) {
int n;
for (n = 0; n < matroska->num_packets; n++) {
av_free_packet(matroska->packets[n]);
av_free(matroska->packets[n]);
}
av_free(matroska->packets);
matroska->packets = NULL;
}
}
/*
* Autodetecting...
......@@ -2690,13 +2707,7 @@ matroska_read_close (AVFormatContext *s)
av_free(matroska->muxing_app);
av_free(matroska->index);
if (matroska->packets != NULL) {
for (n = 0; n < matroska->num_packets; n++) {
av_free_packet(matroska->packets[n]);
av_free(matroska->packets[n]);
}
av_free(matroska->packets);
}
matroska_clear_queue(matroska);
for (n = 0; n < matroska->num_tracks; n++) {
MatroskaTrack *track = matroska->tracks[n];
......
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