mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
avformat/oggdec: Avoid duplicating buffer when adding side-data
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
9fee37c56e
commit
c0f01eaf12
@ -877,14 +877,12 @@ retry:
|
||||
}
|
||||
|
||||
if (os->new_metadata) {
|
||||
uint8_t *side_data = av_packet_new_side_data(pkt,
|
||||
AV_PKT_DATA_METADATA_UPDATE,
|
||||
os->new_metadata_size);
|
||||
if(!side_data)
|
||||
return AVERROR(ENOMEM);
|
||||
ret = av_packet_add_side_data(pkt, AV_PKT_DATA_METADATA_UPDATE,
|
||||
os->new_metadata, os->new_metadata_size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
memcpy(side_data, os->new_metadata, os->new_metadata_size);
|
||||
av_freep(&os->new_metadata);
|
||||
os->new_metadata = NULL;
|
||||
os->new_metadata_size = 0;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ static int vorbis_update_metadata(AVFormatContext *s, int idx)
|
||||
os->new_metadata = av_packet_pack_dictionary(st->metadata, &os->new_metadata_size);
|
||||
/* Send an empty dictionary to indicate that metadata has been cleared. */
|
||||
} else {
|
||||
os->new_metadata = av_malloc(1);
|
||||
os->new_metadata = av_mallocz(1);
|
||||
os->new_metadata_size = 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user