From 132fcca4b26865a3152502856928cec8d87496ce Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Thu, 26 Jul 2012 12:29:18 +0200 Subject: Make codec_realloc retain the contents when resizing a memory segment Change-Id: Ia2fc42eb0d36399e6856d3a957dd1634f019ca6a --- lib/rbcodec/codecs/lib/codeclib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rbcodec/codecs/lib/codeclib.c b/lib/rbcodec/codecs/lib/codeclib.c index 4859da3155..09c96f921c 100644 --- a/lib/rbcodec/codecs/lib/codeclib.c +++ b/lib/rbcodec/codecs/lib/codeclib.c @@ -90,8 +90,9 @@ void codec_free(void* ptr) { void* codec_realloc(void* ptr, size_t size) { void* x; - (void)ptr; x = codec_malloc(size); + memcpy(x, ptr, size); + codec_free(ptr); return(x); } -- cgit v1.2.3