diff options
author | H. Peter Anvin <hpa@zytor.com> | 2001-10-23 06:01:43 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2001-10-23 06:01:43 +0000 |
commit | fbb530110cb5127532ed6ff1081f84abf574c43d (patch) | |
tree | fd8ab0a521e7b90729f9e2b28e9bdd796d32e219 /free.c | |
parent | d15e7744e7ab4cb7fa0ebdd8e8d652674dd95afa (diff) | |
download | lpsm-fbb530110cb5127532ed6ff1081f84abf574c43d.tar.gz lpsm-fbb530110cb5127532ed6ff1081f84abf574c43d.tar.xz lpsm-fbb530110cb5127532ed6ff1081f84abf574c43d.zip |
Be a bit more correct: set errno to ENOMEM if we fail to allocate
memory.
Diffstat (limited to 'free.c')
-rw-r--r-- | free.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -148,8 +148,10 @@ void lpsm_free_slab(void *ptr) void lpsm_free(void *ptr) { /* Buddy allocations are ALWAYS page-aligned, SLAB allocations never */ - if ( (uintptr_t)ptr & (BUDDY_SIZE_MIN-1) ) - lpsm_free_slab(ptr); - else - lpsm_free_buddy(ptr); + if ( ptr ) { + if ( (uintptr_t)ptr & (BUDDY_SIZE_MIN-1) ) + lpsm_free_slab(ptr); + else + lpsm_free_buddy(ptr); + } } |