You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
456 B
27 lines
456 B
diff --git a/C/Alloc.c b/C/Alloc.c
|
|
index 2706ec0..3178e7a 100644
|
|
--- a/C/Alloc.c
|
|
+++ b/C/Alloc.c
|
|
@@ -58,12 +58,18 @@ void align_free(void * ptr)
|
|
#else
|
|
void *align_alloc(size_t size)
|
|
{
|
|
- return malloc(size);
|
|
+ void * p = malloc(size);
|
|
+ if(!p){
|
|
+ printf("Out of memory: can't allocate %u bytes\n",size);
|
|
+ abort();
|
|
+ }
|
|
+ return p;
|
|
}
|
|
|
|
void align_free(void * ptr)
|
|
{
|
|
- free(ptr);
|
|
+ if(!ptr) return;
|
|
+ free(ptr);
|
|
}
|
|
|
|
#endif
|
|
|