From 3924d0f169525270e20b6183ee67bca5822d0291 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Fri, 22 Oct 2010 12:26:24 -0300 Subject: [PATCH] rev: use xalloc for memory allocation Signed-off-by: Davidlohr Bueso --- text-utils/rev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); -- 2.39.5