mirror of https://git.ffmpeg.org/ffmpeg.git
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:
parent
2b6b19dd9b
commit
7ac1dc2364
|
@ -456,17 +456,17 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src)
|
||||||
|
|
||||||
ret = frame_copy_props(dst, src, 0);
|
ret = frame_copy_props(dst, src, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
goto fail;
|
||||||
|
|
||||||
/* duplicate the frame data if it's not refcounted */
|
/* duplicate the frame data if it's not refcounted */
|
||||||
if (!src->buf[0]) {
|
if (!src->buf[0]) {
|
||||||
ret = av_frame_get_buffer(dst, 0);
|
ret = av_frame_get_buffer(dst, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
goto fail;
|
||||||
|
|
||||||
ret = av_frame_copy(dst, src);
|
ret = av_frame_copy(dst, src);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
av_frame_unref(dst);
|
goto fail;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue