From 5626f994f273af80fb100d4743b963304de9e05c Mon Sep 17 00:00:00 2001 From: Alexandra Khirnova Date: Wed, 18 Sep 2013 18:12:36 +0200 Subject: avformat: Use av_reallocp() where suitable Signed-off-by: Diego Biurrun --- libavformat/rdt.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'libavformat/rdt.c') diff --git a/libavformat/rdt.c b/libavformat/rdt.c index a8367e51ca..d691ae904f 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -419,15 +419,14 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index, for (n = 0; n < s->nb_streams; n++) if (s->streams[n]->id == stream->id) { - int count = s->streams[n]->index + 1; + int count = s->streams[n]->index + 1, err; if (first == -1) first = n; if (rdt->nb_rmst < count) { - RMStream **rmst= av_realloc(rdt->rmst, count*sizeof(*rmst)); - if (!rmst) - return AVERROR(ENOMEM); - memset(rmst + rdt->nb_rmst, 0, - (count - rdt->nb_rmst) * sizeof(*rmst)); - rdt->rmst = rmst; + if ((err = av_reallocp(&rdt->rmst, + count * sizeof(*rdt->rmst))) < 0) + return err; + memset(rdt->rmst + rdt->nb_rmst, 0, + (count - rdt->nb_rmst) * sizeof(*rdt->rmst)); rdt->nb_rmst = count; } rdt->rmst[s->streams[n]->index] = ff_rm_alloc_rmstream(); -- cgit v1.2.3