From 9294f538e924dcb8f3938e4e3476340f1e5b552f Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Fri, 6 Apr 2012 22:36:16 +0300 Subject: rtsp: Don't use av_malloc(0) if there are no streams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtspdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libavformat/rtspdec.c') 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; -- cgit v1.2.3