zalloc_malloc.c (182748) | zalloc_malloc.c (223151) |
---|---|
1/* 2 * This module derived from code donated to the FreeBSD Project by 3 * Matthew Dillon <dillon@backplane.com> 4 * 5 * Copyright (c) 1998 The FreeBSD Project 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/* 2 * This module derived from code donated to the FreeBSD Project by 3 * Matthew Dillon <dillon@backplane.com> 4 * 5 * Copyright (c) 1998 The FreeBSD Project 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/lib/libstand/zalloc_malloc.c 182748 2008-09-04 10:05:44Z raj $"); | 31__FBSDID("$FreeBSD: head/lib/libstand/zalloc_malloc.c 223151 2011-06-16 15:35:12Z avatar $"); |
32 33/* 34 * MALLOC.C - malloc equivalent, runs on top of zalloc and uses sbrk 35 */ 36 37#include "zalloc_defs.h" 38 39static MemPool MallocPool; --- 65 unchanged lines hidden (view full) --- 105 res->ga_Magic = GAFREE; 106#endif 107#ifdef USEENDGUARD 108 if (*((signed char *)res + res->ga_Bytes - 1) == -1) { 109 printf("free: duplicate2 free @ %p from %s:%d\n", ptr, file, line); 110 return; 111 } 112 if (*((signed char *)res + res->ga_Bytes - 1) != -2) | 32 33/* 34 * MALLOC.C - malloc equivalent, runs on top of zalloc and uses sbrk 35 */ 36 37#include "zalloc_defs.h" 38 39static MemPool MallocPool; --- 65 unchanged lines hidden (view full) --- 105 res->ga_Magic = GAFREE; 106#endif 107#ifdef USEENDGUARD 108 if (*((signed char *)res + res->ga_Bytes - 1) == -1) { 109 printf("free: duplicate2 free @ %p from %s:%d\n", ptr, file, line); 110 return; 111 } 112 if (*((signed char *)res + res->ga_Bytes - 1) != -2) |
113 panic("free: guard2 fail @ %p + %d from %s:%d", ptr, res->ga_Bytes - MALLOCALIGN, file, line); | 113 panic("free: guard2 fail @ %p + %zu from %s:%d", ptr, res->ga_Bytes - MALLOCALIGN, file, line); |
114 *((signed char *)res + res->ga_Bytes - 1) = -1; 115#endif 116 117 bytes = res->ga_Bytes; 118 zfree(&MallocPool, res, bytes); 119#ifdef DMALLOCDEBUG 120 --MallocCount; 121#endif --- 79 unchanged lines hidden --- | 114 *((signed char *)res + res->ga_Bytes - 1) = -1; 115#endif 116 117 bytes = res->ga_Bytes; 118 zfree(&MallocPool, res, bytes); 119#ifdef DMALLOCDEBUG 120 --MallocCount; 121#endif --- 79 unchanged lines hidden --- |