scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 84128eaf37e33fed023f271018b157b7398ad91c
parent ae0058502d81d2742783b1d1800784319341ff12
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Sun,  4 Jan 2026 21:18:49 +0100

libc/stdlib: Minor improvements to realloc()

Diffstat:
Msrc/libc/stdlib/realloc.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/libc/stdlib/realloc.c b/src/libc/stdlib/realloc.c @@ -15,9 +15,7 @@ realloc(void *ptr, size_t nbytes) if (nbytes == 0) { free(ptr); ptr = NULL; - } - - if (nbytes > SIZE_MAX - sizeof(Header)-1) { + } else if (nbytes > SIZE_MAX - sizeof(Header)-1) { errno = ENOMEM; return NULL; }