summaryrefslogtreecommitdiff
path: root/mkswap.c
diff options
context:
space:
mode:
authorErik Andersen2000-03-21 22:32:57 +0000
committerErik Andersen2000-03-21 22:32:57 +0000
commit0d068a20676144e9fd6796cc77764c420d785394 (patch)
treeaf12b114d51e9ae7a8753baf09feb9ab8d654f26 /mkswap.c
parentc053e41fa0524d828bf90f47e5e3637b8facaadc (diff)
downloadbusybox-0d068a20676144e9fd6796cc77764c420d785394.zip
busybox-0d068a20676144e9fd6796cc77764c420d785394.tar.gz
* all mallocs now use xmalloc (and so are OOM error safe), and
the common error handling saves a few bytes. Thanks to Bob Tinsley <bob@earthrise.demon.co.uk> for the patch. -Erik
Diffstat (limited to 'mkswap.c')
-rw-r--r--mkswap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mkswap.c b/mkswap.c
index 130d241..17866a7 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -116,7 +116,7 @@ static void init_signature_page()
if (pagesize != PAGE_SIZE)
fprintf(stderr, "Assuming pages of size %d\n", pagesize);
#endif
- signature_page = (int *) malloc(pagesize);
+ signature_page = (int *) xmalloc(pagesize);
memset(signature_page, 0, pagesize);
p = (struct swap_header_v1 *) signature_page;
}
@@ -230,9 +230,7 @@ void check_blocks(void)
int do_seek = 1;
char *buffer;
- buffer = malloc(pagesize);
- if (!buffer)
- die("Out of memory");
+ buffer = xmalloc(pagesize);
current_page = 0;
while (current_page < PAGES) {
if (!check) {