* Checks an item to make sure it hasn't been overwritten since it was freed, * prior to subsequent reallocation. * * Complies with standard ctor arg/return */
| 64 | * Complies with standard ctor arg/return |
| 65 | */ |
| 66 | int |
| 67 | trash_ctor(void *mem, int size, void *arg, int flags) |
| 68 | { |
| 69 | int cnt; |
| 70 | uint32_t *p; |
| 71 | |
| 72 | #ifdef DEBUG_MEMGUARD |
| 73 | if (is_memguard_addr(mem)) |
| 74 | return (0); |
| 75 | #endif |
| 76 | |
| 77 | cnt = size / sizeof(uma_junk); |
| 78 | |
| 79 | for (p = mem; cnt > 0; cnt--, p++) |
| 80 | if (*p != uma_junk) { |
| 81 | #ifdef INVARIANTS |
| 82 | panic("Memory modified after free %p(%d) val=%x @ %p\n", |
| 83 | mem, size, *p, p); |
| 84 | #else |
| 85 | printf("Memory modified after free %p(%d) val=%x @ %p\n", |
| 86 | mem, size, *p, p); |
| 87 | #endif |
| 88 | return (0); |
| 89 | } |
| 90 | return (0); |
| 91 | } |
| 92 | |
| 93 | /* |
| 94 | * Fills an item with predictable garbage |
no test coverage detected