Based on a suggestion by Ronald S. Bultje
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -233,10 +233,14 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, |
| 233 | 233 |
|
| 234 | 234 |
int cur_len = start_off + len_off - off; |
| 235 | 235 |
int prev_len = out_len; |
| 236 |
+ void *newbuf; |
|
| 236 | 237 |
out_len += cur_len; |
| 237 |
- asf->buf = av_realloc(asf->buf, out_len); |
|
| 238 |
- if(!asf->buf || FFMIN(cur_len, len - off)<0) |
|
| 238 |
+ if(FFMIN(cur_len, len - off)<0) |
|
| 239 | 239 |
return -1; |
| 240 |
+ newbuf = av_realloc(asf->buf, out_len); |
|
| 241 |
+ if(!newbuf) |
|
| 242 |
+ return -1; |
|
| 243 |
+ asf->buf= newbuf; |
|
| 240 | 244 |
memcpy(asf->buf + prev_len, buf + off, |
| 241 | 245 |
FFMIN(cur_len, len - off)); |
| 242 | 246 |
avio_skip(pb, cur_len); |