1
mirror of https://github.com/mpv-player/mpv synced 2024-10-02 16:25:33 +02:00

mp_image: fix subtle side data memory leaks

We must not create new references herem because mp_image_new_ref() is
called later, and actually creates new references (including doing
actual error checking). Blame C, not me.
This commit is contained in:
wm4 2018-03-01 13:39:45 +01:00 committed by Jan Ekström
parent 6f27a165a8
commit e0c67977b2

View File

@ -877,7 +877,7 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
#if LIBAVUTIL_VERSION_MICRO >= 100 #if LIBAVUTIL_VERSION_MICRO >= 100
sd = av_frame_get_side_data(src, AV_FRAME_DATA_ICC_PROFILE); sd = av_frame_get_side_data(src, AV_FRAME_DATA_ICC_PROFILE);
if (sd) if (sd)
dst->icc_profile = av_buffer_ref(sd->buf); dst->icc_profile = sd->buf;
// Get the content light metadata if available // Get the content light metadata if available
sd = av_frame_get_side_data(src, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL); sd = av_frame_get_side_data(src, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
@ -896,7 +896,7 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *src)
sd = av_frame_get_side_data(src, AV_FRAME_DATA_A53_CC); sd = av_frame_get_side_data(src, AV_FRAME_DATA_A53_CC);
if (sd) if (sd)
dst->a53_cc = av_buffer_ref(sd->buf); dst->a53_cc = sd->buf;
#endif #endif
if (dst->hwctx) { if (dst->hwctx) {