On Sat, Feb 27, 2016 at 9:15 AM, wm4 <nfx...@googlemail.com> wrote:
> ---
>  libavutil/frame.h | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index 5a04177..6f5d733 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -391,6 +391,10 @@ void av_frame_free(AVFrame **frame);
>   * If src is not reference counted, new buffers are allocated and the data is
>   * copied.
>   *
> + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
> + *           or newly allocated with av_frame_alloc() before calling this
> + *           function, or undefined behavior will occur.

don't you just have to make sure that the frame is allocated?
what undefined behaviour are we talking about?

> + *
>   * @return 0 on success, a negative AVERROR on error
>   */
>  int av_frame_ref(AVFrame *dst, const AVFrame *src);
> @@ -410,7 +414,11 @@ AVFrame *av_frame_clone(const AVFrame *src);
>  void av_frame_unref(AVFrame *frame);
>
>  /**
> - * Move everythnig contained in src to dst and reset src.
> + * Move everything contained in src to dst and reset src.
> + *
> + * @warning: dst is not unreferenced, but blindly overwritten without 
> checking

it could do without 'blindly' but ok otherwise

> + *           or deallocating its contents. Call av_frame_unref(dst) manually
> + *           before calling this function to ensure that no memory is leaked.
>   */
>  void av_frame_move_ref(AVFrame *dst, AVFrame *src);
>
> @@ -426,6 +434,10 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
>   * necessary, allocate and fill AVFrame.extended_data and 
> AVFrame.extended_buf.
>   * For planar formats, one buffer will be allocated for each plane.
>   *
> + * @warning: if frame already has been allocated, calling this function will
> + *           leak memory. In addition, undefined behavior can occur in 
> certain
> + *           cases.

ok
-- 
Vittorio
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to