aboutsummaryrefslogtreecommitdiff
path: root/libavformat/rdt.c
diff options
context:
space:
mode:
authorMartin Storsjö2013-09-26 16:37:02 +0300
committerMartin Storsjö2013-09-26 23:14:03 +0300
commitd872fb0f7ff2ff0ba87f5ccf6a1a55ca2be472c9 (patch)
tree92ef865da60624c41be1e58c505c95508662ad7d /libavformat/rdt.c
parent06ebc0bf9a6401733a4ce1310325de19f631819a (diff)
lavf: Reset the entry count and allocation size variables on av_reallocp failures
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ö <martin@martin.st>
Diffstat (limited to 'libavformat/rdt.c')
-rw-r--r--libavformat/rdt.c4
1 files changed, 3 insertions, 1 deletions
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;