aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oggdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-05-23 13:06:04 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-05-28 12:04:26 +0200
commitc0f01eaf12479b5d0160e1a8d10a73744fac5ab2 (patch)
treeee1fcee83756a0632aa6dbe8c4d8c4014e7d2477 /libavformat/oggdec.c
parent9fee37c56e60f9e24bf921188519a062de6185a1 (diff)
downloadffmpeg-c0f01eaf12479b5d0160e1a8d10a73744fac5ab2.tar.gz
avformat/oggdec: Avoid duplicating buffer when adding side-data
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r--libavformat/oggdec.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 1a3acbb55e..b4ba00df61 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -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;
}