move internal queue freeing code in its own function

Originally committed as revision 11350 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs 2007-12-29 18:32:47 +00:00
parent b3d8c2c436
commit 34c9c1baf4

View File

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