From 35fad1e9c90b329b8680787ee5a00c74223c6029 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 15 Jan 2015 00:42:55 +0100 Subject: [PATCH] avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_realloc() This allows reallocating AVBufferRefs without the need to update all pointers to it Signed-off-by: Michael Niedermayer --- libavutil/buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; }