diff --git a/libavutil/buffer.c b/libavutil/buffer.c index ca102fd574..b31f0343b3 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -201,8 +201,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) memcpy(new->data, buf->data, FFMIN(size, buf->size)); - av_buffer_unref(pbuf); - *pbuf = new; + buffer_replace(pbuf, &new); return 0; }