History

lavu: define FF_MEMORY_POISON and use it

Allow single-place definition of constant used to fill poisoned memory.

Stefano Sabatini committed 13 years ago

Commit 84be8061 parent e70e2583 files · +4 −2Browse files

Unified · Split

3 files
  1. libavutil/buffer.c +1 −1
  2. libavutil/internal.h +2 −0
  3. libavutil/mem.c +1 −1
libavutil/buffer.c+1−1
@@ -288,7 +288,7 @@ static void pool_release_buffer(void *opaque, uint8_t *data) · 287 unmodified lines
288 AVBufferPool *pool = buf->pool;288 AVBufferPool *pool = buf->pool;
289 289
290 if(CONFIG_MEMORY_POISONING)290 if(CONFIG_MEMORY_POISONING)
291 memset(buf->data, 0x2a, pool->size);291 memset(buf->data, FF_MEMORY_POISON, pool->size);
292 292
293 add_to_pool(buf);293 add_to_pool(buf);
294 if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))294 if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
libavutil/internal.h+2−0
@@ -66,6 +66,8 @@ · 65 unmodified lines
66# define INT_BIT (CHAR_BIT * sizeof(int))66# define INT_BIT (CHAR_BIT * sizeof(int))
67#endif67#endif
68 68
69#define FF_MEMORY_POISON 0x2a
70
69// Some broken preprocessors need a second expansion71// Some broken preprocessors need a second expansion
70// to be forced to tokenize __VA_ARGS__72// to be forced to tokenize __VA_ARGS__
71#define E1(x) x73#define E1(x) x
libavutil/mem.c+1−1
@@ -133,7 +133,7 @@ void *av_malloc(size_t size) · 132 unmodified lines
133 }133 }
134#if CONFIG_MEMORY_POISONING134#if CONFIG_MEMORY_POISONING
135 if (ptr)135 if (ptr)
136 memset(ptr, 0x2a, size);136 memset(ptr, FF_MEMORY_POISON, size);
137#endif137#endif
138 return ptr;138 return ptr;
139}139}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t