From: Davidlohr Bueso Date: Fri, 22 Oct 2010 15:26:24 +0000 (-0300) Subject: rev: use xalloc for memory allocation X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3924d0f169525270e20b6183ee67bca5822d0291;p=util-linux rev: use xalloc for memory allocation Signed-off-by: Davidlohr Bueso --- diff --git a/text-utils/rev.c b/text-utils/rev.c index 7a42d7e4..b6924497 100644 --- a/text-utils/rev.c +++ b/text-utils/rev.c @@ -59,6 +59,7 @@ #include #include "nls.h" +#include "xalloc.h" #include "widechar.h" wchar_t *buf; @@ -117,9 +118,7 @@ int main(int argc, char *argv[]) filename = *argv++; } - buf = malloc(bufsiz * sizeof(wchar_t)); - if (!buf) - err(EXIT_FAILURE, _("malloc failed")); + buf = xmalloc(bufsiz * sizeof(wchar_t)); while (fgetws(buf, bufsiz, fp)) { len = wcslen(buf);