diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-01 06:34:41 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-11-02 18:28:56 +0100 |
commit | 34871beb5eb6bc59f5e58326a214efd88a4c2ccd (patch) | |
tree | a477c144ab4934ff9a5aa6bbe6bc34115ae659de | |
parent | 9221efef7968463f3e3d9ce79ea72eaca082e73f (diff) | |
download | ffmpeg-34871beb5eb6bc59f5e58326a214efd88a4c2ccd.tar.gz |
matroskadec: do not use avpacket internals
-rw-r--r-- | libavformat/matroskadec.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 26f8707e83..bf67253737 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1137,13 +1137,14 @@ 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; - av_destruct_packet(in); + int old_size = out->size; + int ret = av_grow_packet(out, in->size); + if (ret < 0) + return ret; + + memcpy(out->data + old_size, in->data, in->size); + + av_free_packet(in); av_free(in); return 0; } |