mirror of
https://kernel.googlesource.com/pub/scm/network/tftp/tftp-hpa
synced 2025-05-01 04:19:53 +03:00
Add replacement library files
This commit is contained in:
parent
e6593dd693
commit
d0fec7a322
4 changed files with 87 additions and 0 deletions
21
lib/xmalloc.c
Normal file
21
lib/xmalloc.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* xmalloc.c
|
||||
*
|
||||
* Simple error-checking version of malloc()
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void *xmalloc(size_t size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
|
||||
if ( !p ) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(128);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue