Commit 0bf7924a04 for ffmpeg
commit 0bf7924a04eb205a8ca5d8206d66984ba80d15c9
Author: Sylvestre Ledru <sylvestre@debian.org>
Date: Mon Nov 9 11:29:30 2026 +0100
avcodec/libvpxenc: fix HDR10+ side data leak on OOM in frame_data_submit()
If av_buffer_ref() fails for the SMPTE 2094 APP5 metadata, the function
returned directly and leaked the HDR10+ buffer reference taken just
before. Go through the fail label so frame_data_uninit() releases it.
Regression since e1797cdd51 (avcodec/libvpxenc: Copy Smpte2094App5 metadata).
Noticed while reviewing Coverity (Firefox CID 1701832), which is itself
a false positive: it reports fd.hdr_smpte2094_app5 as leaked on the
success path, where ownership is transferred to the FIFO.
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 942e28dd73..076cbc0fe3 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -387,8 +387,10 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo,
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_SMPTE_2094_APP5);
if (sd) {
fd.hdr_smpte2094_app5 = av_buffer_ref(sd->buf);
- if (!fd.hdr_smpte2094_app5)
- return AVERROR(ENOMEM);
+ if (!fd.hdr_smpte2094_app5) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
}
fd.duration = frame->duration;