diff options
author | NeilBrown <neilb@suse.de> | 2012-07-09 17:14:16 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-07-09 17:14:16 +1000 |
commit | 503975b9d5f0696b5d2ee20ea903b859e3f60662 (patch) | |
tree | 171c9f9b9db109325fad7f81ba07671d84a085a5 /super-mbr.c | |
parent | c8e1a230b73c44aff5beeeb74d32e36219bed12d (diff) |
Remove scattered checks for malloc success.
malloc should never fail, and if it does it is unlikely
that anything else useful can be done. Best approach is to
abort and let some super-daemon restart.
So define xmalloc, xcalloc, xrealloc, xstrdup which don't
fail but just print a message and exit. Then use those
removing all the tests for failure.
Also replace all "malloc;memset" sequences with 'xcalloc'.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-mbr.c')
-rw-r--r-- | super-mbr.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/super-mbr.c b/super-mbr.c index 3b0cc8d8..bbbc65bf 100644 --- a/super-mbr.c +++ b/super-mbr.c @@ -174,9 +174,7 @@ static struct supertype *match_metadata_desc(char *arg) if (strcmp(arg, "mbr") != 0) return NULL; - st = malloc(sizeof(*st)); - if (!st) - return st; + st = xmalloc(sizeof(*st)); st->ss = &mbr; st->info = NULL; st->minor_version = 0; |