1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avutil/frame: fix potential leaks in av_frame_ref()

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Gil Pedersen 2020-11-18 13:05:18 +00:00 committed by James Almer
parent 2b6b19dd9b
commit 7ac1dc2364

View File

@ -456,17 +456,17 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src)
ret = frame_copy_props(dst, src, 0);
if (ret < 0)
return ret;
goto fail;
/* duplicate the frame data if it's not refcounted */
if (!src->buf[0]) {
ret = av_frame_get_buffer(dst, 0);
if (ret < 0)
return ret;
goto fail;
ret = av_frame_copy(dst, src);
if (ret < 0)
av_frame_unref(dst);
goto fail;
return ret;
}