aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-07 16:48:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-07 16:57:15 +0200
commit61f55565fb96158a70ddc56c9e44312ffbd3cce5 (patch)
treeb6c785a306a8e4a1e6876fa4231bf67179451dd1 /libavformat
parentb6b46db9e4fac641d2111c63f02b694250a5e90c (diff)
downloadffmpeg-61f55565fb96158a70ddc56c9e44312ffbd3cce5.tar.gz
rtpdec_asf: fix memleakn0.7.4
Based on a suggestion by Ronald S. Bultje Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit a2b66a366d7d9d7dacc217601b5e4406624f91ea)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rtpdec_asf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index 384aeb24f3..643ea7a5a0 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -233,10 +233,14 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
int cur_len = start_off + len_off - off;
int prev_len = out_len;
+ void *newbuf;
out_len += cur_len;
- asf->buf = av_realloc(asf->buf, out_len);
- if(!asf->buf || FFMIN(cur_len, len - off)<0)
+ if(FFMIN(cur_len, len - off)<0)
return -1;
+ newbuf = av_realloc(asf->buf, out_len);
+ if(!newbuf)
+ return -1;
+ asf->buf= newbuf;
memcpy(asf->buf + prev_len, buf + off,
FFMIN(cur_len, len - off));
avio_skip(pb, cur_len);