summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-03-24 01:44:48 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-24 01:44:48 +0100
commit058c0029322f63728b4e9e35c6f110e05a17d065 (patch)
treed40888db9562336c99aee1ee6e0db36be6ab3bfc /libavutil
parentd6f9610853d5bc8b481bc252589c0342d1d7b77a (diff)
avutil/buffer: support memory poisoning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/buffer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index fc389a56f6..592527cff4 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -71,6 +71,9 @@ AVBufferRef *av_buffer_alloc(int size)
if (!data)
return NULL;
+ if(CONFIG_MEMORY_POISONING)
+ memset(data, 0x2a, size);
+
ret = av_buffer_create(data, size, av_buffer_default_free, NULL, 0);
if (!ret)
av_freep(&data);
@@ -276,6 +279,10 @@ static void pool_release_buffer(void *opaque, uint8_t *data)
{
BufferPoolEntry *buf = opaque;
AVBufferPool *pool = buf->pool;
+
+ if(CONFIG_MEMORY_POISONING)
+ memset(buf->data, 0x2a, pool->size);
+
add_to_pool(buf);
if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
buffer_pool_free(pool);