diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-04-16 18:02:02 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-04-16 22:17:24 +0200 |
commit | dcd207c4cbcd9dd72b73e5b544c055b29885be64 (patch) | |
tree | 1529b39fbacb41be7de5db2789195e2a5136a758 /libavformat | |
parent | 1a65d50ee75372519625fff49d1d1a95ff5f4a6f (diff) | |
download | ffmpeg-dcd207c4cbcd9dd72b73e5b544c055b29885be64.tar.gz |
matroskadec: use av_grow_packet in merge_packets.
It ensures that the packet is properly padded
and makes the code simpler.
Fixes trac ticket #1223.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/matroskadec.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 27d84adbc2..a484c50949 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1126,12 +1126,10 @@ static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska, static int matroska_merge_packets(AVPacket *out, AVPacket *in) { - void *newdata = av_realloc(out->data, out->size+in->size); - if (!newdata) - return AVERROR(ENOMEM); - out->data = newdata; - memcpy(out->data+out->size, in->data, in->size); - out->size += in->size; + int ret = av_grow_packet(out, in->size); + if (ret < 0) + return ret; + memcpy(out->data + out->size - in->size, in->data, in->size); av_destruct_packet(in); av_free(in); return 0; |