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

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2012-04-06 22:36:16 +03:00
parent 62c3c8ca78
commit 9294f538e9
1 changed files with 3 additions and 2 deletions

View File

@ -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;