summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2007-12-29 18:32:47 +0000
committerAurelien Jacobs <aurel@gnuage.org>2007-12-29 18:32:47 +0000
commit34c9c1baf4846a78fd46763fb7a7143120cf5863 (patch)
tree1ada104152ba632e968d908e9ad7d8d2f7d15c74 /libavformat/matroskadec.c
parentb3d8c2c4368d64af4564961bd57465f54e1fcaad (diff)
downloadffmpeg-34c9c1baf4846a78fd46763fb7a7143120cf5863.tar.gz
move internal queue freeing code in its own function
Originally committed as revision 11350 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index a2be2425ed..20e071b8d2 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -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];