[PATCH 6/7] rev: use xalloc for memory allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Davidlohr Bueso <dave@xxxxxxx>
Date: Fri, 22 Oct 2010 12:26:24 -0300
Subject: [PATCH 6/7] rev: use xalloc for memory allocation

Signed-off-by: Davidlohr Bueso <dave@xxxxxxx>
---
 text-utils/rev.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/text-utils/rev.c b/text-utils/rev.c
index 907b032..a04114f 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -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);
-- 
1.7.0.4






--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux