diff options
author | Denis Vlasenko | 2007-04-10 21:40:19 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-04-10 21:40:19 +0000 |
commit | c6758a07c68033627a692cda27aebc8f6a662e7f (patch) | |
tree | 51bc0b498a5e16f8041604d913e25708cc76058f /libbb/xfuncs.c | |
parent | 335b63d8d1876ce4e172ebcc9d64544785682244 (diff) | |
download | busybox-c6758a07c68033627a692cda27aebc8f6a662e7f.zip busybox-c6758a07c68033627a692cda27aebc8f6a662e7f.tar.gz |
make compressed help code NOMMU- and NOFORK-friendly -
no forking anymore, bunzip2 unpack routine now does all it in memory.
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r-- | libbb/xfuncs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index b9d013a..dde91a2 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -20,6 +20,15 @@ * Since dmalloc's prototypes overwrite the impls here as they are * included after these prototypes in libbb.h, all is well. */ +// Warn if we can't allocate size bytes of memory. +void *malloc_or_warn(size_t size) +{ + void *ptr = malloc(size); + if (ptr == NULL && size != 0) + bb_error_msg(bb_msg_memory_exhausted); + return ptr; +} + // Die if we can't allocate size bytes of memory. void *xmalloc(size_t size) { |