[FFmpeg-devel] [PATCH] lavu/buffer: forward av_buffer_realloc() error code.

Paul B Mahol onemda at gmail.com
Sat Jan 4 21:04:19 EET 2020


On 1/4/20, Nicolas George <george at nsup.org> wrote:
> Fix CID 1457235.
>
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavutil/buffer.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavutil/buffer.c b/libavutil/buffer.c
> index 6d9cb7428e..2f33e5ebb6 100644
> --- a/libavutil/buffer.c
> +++ b/libavutil/buffer.c
> @@ -171,6 +171,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size)
>  {
>      AVBufferRef *buf = *pbuf;
>      uint8_t *tmp;
> +    int ret;
>
>      if (!buf) {
>          /* allocate a new buffer with av_realloc(), so it will be
> reallocatable
> @@ -197,9 +198,9 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size)
>          /* cannot realloc, allocate a new reallocable buffer and copy data
> */
>          AVBufferRef *new = NULL;
>
> -        av_buffer_realloc(&new, size);
> +        ret = av_buffer_realloc(&new, size);
>          if (!new)
> -            return AVERROR(ENOMEM);
> +            return ret;
>
>          memcpy(new->data, buf->data, FFMIN(size, buf->size));
>
> --
> 2.24.1
>

OK

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list