From b7159bd5c901b7f785b0b3370b70a0ec5e4ffcf6 Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Fri, 22 Oct 2010 12:23:31 -0300 Subject: [PATCH] tailf: use xalloc for memory allocation Signed-off-by: Davidlohr Bueso --- text-utils/tailf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/text-utils/tailf.c b/text-utils/tailf.c index dc18b2a6..2dcdba3f 100644 --- a/text-utils/tailf.c +++ b/text-utils/tailf.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -40,7 +39,9 @@ #ifdef HAVE_INOTIFY_INIT #include #endif + #include "nls.h" +#include "xalloc.h" #include "usleep.h" #define DEFAULT_LINES 10 @@ -57,7 +58,7 @@ tailf(const char *filename, int lines) if (!(str = fopen(filename, "r"))) err(EXIT_FAILURE, _("cannot open \"%s\" for read"), filename); - buf = malloc(lines * BUFSIZ); + buf = xmalloc(lines * BUFSIZ); p = buf; while (fgets(p, BUFSIZ, str)) { if (++tail >= lines) { -- 2.39.5