avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_rea...
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 14 Jan 2015 23:42:55 +0000 (00:42 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Mar 2015 01:15:28 +0000 (02:15 +0100)
This allows reallocating AVBufferRefs without the need to update
all pointers to it

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/buffer.c

index ca102fd..b31f034 100644 (file)
@@ -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;
     }