From d872fb0f7ff2ff0ba87f5ccf6a1a55ca2be472c9 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Thu, 26 Sep 2013 16:37:02 +0300 Subject: lavf: Reset the entry count and allocation size variables on av_reallocp failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When av_reallocp fails, the associated variables that keep track of the number of elements in the array (and in some cases, the separate number of allocated elements) need to be reset. Not all of these might technically be needed, but it's better to reset them if in doubt, to make sure variables don't end up conflicting. Signed-off-by: Martin Storsjö --- libavformat/rdt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavformat/rdt.c') diff --git a/libavformat/rdt.c b/libavformat/rdt.c index d691ae904f..33b0eb827e 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -423,8 +423,10 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index, if (first == -1) first = n; if (rdt->nb_rmst < count) { if ((err = av_reallocp(&rdt->rmst, - count * sizeof(*rdt->rmst))) < 0) + count * sizeof(*rdt->rmst))) < 0) { + rdt->nb_rmst = 0; return err; + } memset(rdt->rmst + rdt->nb_rmst, 0, (count - rdt->nb_rmst) * sizeof(*rdt->rmst)); rdt->nb_rmst = count; -- cgit v1.2.3