diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/HBconfig | 5 | ||||
-rw-r--r-- | src/lib/stdlib.C | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/lib/HBconfig b/src/lib/HBconfig new file mode 100644 index 000000000..05added71 --- /dev/null +++ b/src/lib/HBconfig @@ -0,0 +1,5 @@ +config MALLOC_FENCING + default n + help + Enable generating check bytes around each malloc and + enforcing that those bytes are undisturbed on every matching free diff --git a/src/lib/stdlib.C b/src/lib/stdlib.C index 610a045a3..a7c694f9d 100644 --- a/src/lib/stdlib.C +++ b/src/lib/stdlib.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -28,6 +28,7 @@ #include <kernel/heapmgr.H> #include <kernel/pagemgr.H> #include <kernel/console.H> +#include <config.h> #ifdef HOSTBOOT_MEMORY_LEAKS #include <arch/ppc.H> @@ -114,10 +115,12 @@ void* malloc(size_t s) return result; } - void free(void* p) { - if (NULL == p) return; + if (nullptr == p) + { + return; + } #ifdef HOSTBOOT_MEMORY_LEAKS memoryleak_magic_instruction(MEMORYLEAK_FREE, 0, p, NULL); @@ -126,10 +129,12 @@ void free(void* p) HeapManager::free(p); } - void* realloc(void* p, size_t s) { - if (NULL == p) return malloc(s); + if (nullptr == p) + { + return malloc(s); + } void* result = HeapManager::realloc(p,s); |