[FFmpeg-cvslog] asfdec: increment nb_streams right after the stream allocation

Alexandra Hájková git at videolan.org
Thu Jul 23 11:51:10 CEST 2015


ffmpeg | branch: master | Alexandra Hájková <alexandra.khirnova at gmail.com> | Thu Jul 23 08:59:53 2015 +0200| [aed7715b8fa295980c221f1cd095d42cd3bd74a6] | committer: Anton Khirnov

asfdec: increment nb_streams right after the stream allocation

to prevent possible memory leaks

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aed7715b8fa295980c221f1cd095d42cd3bd74a6
---

 libavformat/asfdec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 305c01c..d9e9a5a 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -745,6 +745,7 @@ static int asf_read_stream_properties(AVFormatContext *s, const GUIDParseTable *
     if (!asf->asf_st[asf->nb_streams])
         return AVERROR(ENOMEM);
     asf_st                       = asf->asf_st[asf->nb_streams];
+    asf->nb_streams++;
     asf_st->stream_index         = stream_index;
     asf_st->index                = st->index;
     asf_st->indexed              = 0;
@@ -785,7 +786,6 @@ static int asf_read_stream_properties(AVFormatContext *s, const GUIDParseTable *
             avio_skip(pb, err_data_len);
     }
 
-    asf->nb_streams++;
     align_position(pb, asf->offset, size);
 
     return 0;



More information about the ffmpeg-cvslog mailing list