[FFmpeg-cvslog] rtsp: Don't use av_malloc(0) if there are no streams

Martin Storsjö git at videolan.org
Sun Apr 8 21:08:03 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Fri Apr  6 22:36:16 2012 +0300| [9294f538e924dcb8f3938e4e3476340f1e5b552f] | committer: Martin Storsjö

rtsp: Don't use av_malloc(0) if there are no streams

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/rtspdec.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 9306384..063e825 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -159,8 +159,9 @@ static int rtsp_read_header(AVFormatContext *s)
     if (ret)
         return ret;
 
-    rt->real_setup_cache = av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache));
-    if (!rt->real_setup_cache)
+    rt->real_setup_cache = !s->nb_streams ? NULL :
+                           av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache));
+    if (!rt->real_setup_cache && s->nb_streams)
         return AVERROR(ENOMEM);
     rt->real_setup = rt->real_setup_cache + s->nb_streams;
 



More information about the ffmpeg-cvslog mailing list