aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtspdec.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-04-06 22:36:16 +0300
committerMartin Storsjö <martin@martin.st>2012-04-08 15:51:33 +0300
commit9294f538e924dcb8f3938e4e3476340f1e5b552f (patch)
tree2fb9fc87e4ef984ff2c4683e2301950e0b2028ce /libavformat/rtspdec.c
parent62c3c8ca78ee2da7dc20c2d6371866266c82966d (diff)
downloadffmpeg-9294f538e924dcb8f3938e4e3476340f1e5b552f.tar.gz
rtsp: Don't use av_malloc(0) if there are no streams
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtspdec.c')
-rw-r--r--libavformat/rtspdec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 9306384555..063e82501c 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;