From: Davidlohr Bueso Date: Mon, 29 Nov 2010 12:27:04 +0000 (-0300) Subject: wall: use xalloc lib X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b5156cbfa365048c2b5e794c41cc201a49bf878;p=util-linux wall: use xalloc lib Signed-off-by: Davidlohr Bueso --- diff --git a/login-utils/wall.c b/login-utils/wall.c index 38c54426..0f434951 100644 --- a/login-utils/wall.c +++ b/login-utils/wall.c @@ -58,6 +58,7 @@ #include #include "nls.h" +#include "xalloc.h" #include "strutils.h" #include "ttymsg.h" #include "pathnames.h" @@ -242,10 +243,8 @@ makemsg(fname) exit(1); } mbufsize = sbuf.st_size; - if (!(mbuf = malloc((u_int)mbufsize))) { - (void)fprintf(stderr, _("%s: Out of memory!\n"), progname); - exit(1); - } + mbuf = xmalloc(mbufsize); + if (fread(mbuf, sizeof(*mbuf), mbufsize, fp) != mbufsize) { (void)fprintf(stderr, _("%s: can't read temporary file.\n"), progname); exit(1);