diff src/wma/libffwma/futils.c @ 1156:46476de8fc64 trunk

[svn] - avoid a memory leak with FD probing
author nenolod
date Thu, 31 May 2007 17:13:04 -0700
parents aa044d71838f
children ed2d7787779e
line wrap: on
line diff
--- a/src/wma/libffwma/futils.c	Thu May 31 10:33:46 2007 -0700
+++ b/src/wma/libffwma/futils.c	Thu May 31 17:13:04 2007 -0700
@@ -1553,6 +1553,37 @@
 }
 
 /**
+ * Close a media file (but not its codecs)
+ * Does not close the VFS handle.
+ *
+ * @param s media file handle
+ */
+void av_close_input_vfsfile(AVFormatContext *s)
+{
+    int i, must_open_file;
+    AVStream *st;
+
+    /* free previous packet */
+    if (s->cur_st && s->cur_st->parser)
+        av_free_packet(&s->cur_pkt); 
+
+    if (s->iformat->read_close)
+        s->iformat->read_close(s);
+    for(i=0;i<s->nb_streams;i++) {
+        /* free all data in a stream component */
+        st = s->streams[i];
+        if (st->parser) {
+            av_parser_close(st->parser);
+        }
+        free(st->index_entries);
+        free(st);
+    }
+    flush_packet_queue(s);
+    av_freep(&s->priv_data);
+    free(s);
+}
+
+/**
  * Add a new stream to a media file. Can only be called in the
  * read_header function. If the flag AVFMTCTX_NOHEADER is in the
  * format context, then new streams can be added in read_packet too.