diff options
author | Alasdair Kergon <agk@redhat.com> | 2006-08-18 21:38:58 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2006-08-18 21:38:58 +0000 |
commit | d6a93541b62baa9c1115aeac21a68ec6db83a427 (patch) | |
tree | 1a988e2e5353163699cd0741504f119dbd516093 /libdm/mm | |
parent | d68336a52f7551da53ffc772c8330834078e386c (diff) | |
download | lvm2-d6a93541b62baa9c1115aeac21a68ec6db83a427.tar.gz lvm2-d6a93541b62baa9c1115aeac21a68ec6db83a427.tar.xz lvm2-d6a93541b62baa9c1115aeac21a68ec6db83a427.zip |
reorder bounds check code
Diffstat (limited to 'libdm/mm')
-rw-r--r-- | libdm/mm/dbg_malloc.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libdm/mm/dbg_malloc.c b/libdm/mm/dbg_malloc.c index 34864444..48fd43dc 100644 --- a/libdm/mm/dbg_malloc.c +++ b/libdm/mm/dbg_malloc.c @@ -77,15 +77,6 @@ void *dm_malloc_aux_debug(size_t s, const char *file, int line) nb->length = s; nb->id = ++_mem_stats.block_serialno; nb->next = 0; - nb->prev = _tail; - - /* link to tail of the list */ - if (!_head) - _head = _tail = nb; - else { - _tail->next = nb; - _tail = nb; - } /* stomp a pretty pattern across the new memory and fill in the boundary bytes */ @@ -99,6 +90,16 @@ void *dm_malloc_aux_debug(size_t s, const char *file, int line) *ptr++ = (char) nb->id; } + nb->prev = _tail; + + /* link to tail of the list */ + if (!_head) + _head = _tail = nb; + else { + _tail->next = nb; + _tail = nb; + } + _mem_stats.blocks_allocated++; if (_mem_stats.blocks_allocated > _mem_stats.blocks_max) _mem_stats.blocks_max = _mem_stats.blocks_allocated; |