avutil/frame: fix potential leaks in av_frame_ref()

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
pull/358/head
Gil Pedersen 4 years ago committed by James Almer
parent 2b6b19dd9b
commit 7ac1dc2364
  1. 6
      libavutil/frame.c

@ -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;
}

Loading…
Cancel
Save