Commit 84be8069 authored by Stefano Sabatini's avatar Stefano Sabatini

lavu: define FF_MEMORY_POISON and use it

Allow single-place definition of constant used to fill poisoned memory.
parent e70e2583
...@@ -288,7 +288,7 @@ static void pool_release_buffer(void *opaque, uint8_t *data) ...@@ -288,7 +288,7 @@ static void pool_release_buffer(void *opaque, uint8_t *data)
AVBufferPool *pool = buf->pool; AVBufferPool *pool = buf->pool;
if(CONFIG_MEMORY_POISONING) if(CONFIG_MEMORY_POISONING)
memset(buf->data, 0x2a, pool->size); memset(buf->data, FF_MEMORY_POISON, pool->size);
add_to_pool(buf); add_to_pool(buf);
if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1)) if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
# define INT_BIT (CHAR_BIT * sizeof(int)) # define INT_BIT (CHAR_BIT * sizeof(int))
#endif #endif
#define FF_MEMORY_POISON 0x2a
// Some broken preprocessors need a second expansion // Some broken preprocessors need a second expansion
// to be forced to tokenize __VA_ARGS__ // to be forced to tokenize __VA_ARGS__
#define E1(x) x #define E1(x) x
......
...@@ -133,7 +133,7 @@ void *av_malloc(size_t size) ...@@ -133,7 +133,7 @@ void *av_malloc(size_t size)
} }
#if CONFIG_MEMORY_POISONING #if CONFIG_MEMORY_POISONING
if (ptr) if (ptr)
memset(ptr, 0x2a, size); memset(ptr, FF_MEMORY_POISON, size);
#endif #endif
return ptr; return ptr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment