changeset 1156:46476de8fc64 trunk

[svn] - avoid a memory leak with FD probing
author nenolod
date Thu, 31 May 2007 17:13:04 -0700
parents 6f5a4f0b6fb4
children 968092bcb1ba
files ChangeLog src/wma/libffwma/avformat.h src/wma/libffwma/futils.c src/wma/wma.c
diffstat 4 files changed, 45 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 31 10:33:46 2007 -0700
+++ b/ChangeLog	Thu May 31 17:13:04 2007 -0700
@@ -1,3 +1,10 @@
+2007-05-31 17:33:46 +0000  Giacomo Lozito <james@develia.org>
+  revision [2476]
+  - curl: allow user to customize connect timeout value using a connect_timeout entry in config file
+  trunk/src/curl/curl.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++++-
+  1 file changed, 51 insertions(+), 1 deletion(-)
+
+
 2007-05-30 16:13:31 +0000  Tony Vroon <chainsaw@gentoo.org>
   revision [2474]
   Updated turkish translation by Murat ?\197?\158enel, closes bug #959.
--- a/src/wma/libffwma/avformat.h	Thu May 31 10:33:46 2007 -0700
+++ b/src/wma/libffwma/avformat.h	Thu May 31 17:13:04 2007 -0700
@@ -546,6 +546,7 @@
 int av_read_play(AVFormatContext *s);
 int av_read_pause(AVFormatContext *s);
 void av_close_input_file(AVFormatContext *s);
+void av_close_input_vfsfile(AVFormatContext *s);
 AVStream *av_new_stream(AVFormatContext *s, int id);
 void av_set_pts_info(AVFormatContext *s, int pts_wrap_bits,
                      int pts_num, int pts_den);
--- 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.
--- a/src/wma/wma.c	Thu May 31 10:33:46 2007 -0700
+++ b/src/wma/wma.c	Thu May 31 17:13:04 2007 -0700
@@ -212,6 +212,12 @@
 
     codec2 = avcodec_find_decoder(c2->codec_id);
 
+    if (!codec2) {
+        av_close_input_vfsfile(ic2);
+        return 0;
+    }
+
+    av_close_input_vfsfile(ic2);
     return 1;
 }