mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-27 21:40:34 +00:00
avformat/movenc: Free extradata after successfull allocation of new instead of before
This avoids erroring out with extradata lost and extradata size mismatching Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
4f6f56114e
commit
ca906e8190
@ -4923,11 +4923,11 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int side_size = 0;
|
||||
uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
|
||||
if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
|
||||
av_free(par->extradata);
|
||||
par->extradata = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!par->extradata) {
|
||||
void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!newextra)
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
av_free(par->extradata);
|
||||
par->extradata = newextra;
|
||||
memcpy(par->extradata, side, side_size);
|
||||
par->extradata_size = side_size;
|
||||
mov->need_rewrite_extradata = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user