From 7302c9c6524938d358f9aad6e68f6bf9db478b0e Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 22 Aug 2021 19:53:59 +0200 Subject: [PATCH] applied uncrustify to malloc source --- kinclude/malloc.c | 2 ++ kinclude/malloc.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kinclude/malloc.c b/kinclude/malloc.c index 8bfc77f..d38a3ac 100644 --- a/kinclude/malloc.c +++ b/kinclude/malloc.c @@ -16,9 +16,11 @@ void malloc_init(malloc_info* given_info) optional_voidptr malloc_stack(size_t size) { void* new_alloc_end = (void*) (((int) allocate_memory_end) - size); + if (new_alloc_end < global_malloc_info.allocate_memory_start) return (optional_voidptr) { .error = ENOMEM }; void* stack_top = allocate_memory_end; + allocate_memory_end = new_alloc_end; return (optional_voidptr) { .value = stack_top }; } diff --git a/kinclude/malloc.h b/kinclude/malloc.h index f3225d9..ee1d650 100644 --- a/kinclude/malloc.h +++ b/kinclude/malloc.h @@ -12,4 +12,4 @@ optional_voidptr malloc_stack(size_t size); void malloc_init(malloc_info* info); -#endif \ No newline at end of file +#endif