]> err.no Git - util-linux/commitdiff
rev: use xalloc for memory allocation
authorDavidlohr Bueso <dave@gnu.org>
Fri, 22 Oct 2010 15:26:24 +0000 (12:26 -0300)
committerKarel Zak <kzak@redhat.com>
Mon, 1 Nov 2010 14:17:11 +0000 (15:17 +0100)
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
text-utils/rev.c

index 7a42d7e493eafda6c1a34a860e042ac14445e0c9..b69244971f766ec3ad5be0c3c44c600ab0629f72 100644 (file)
@@ -59,6 +59,7 @@
 #include <signal.h>
 
 #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);