[PATCH 1/4] rev: use xrealloc from xalloc.h

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

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 text-utils/rev.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/text-utils/rev.c b/text-utils/rev.c
index 89e5e58..31004a0 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -125,19 +125,11 @@ int main(int argc, char *argv[])
 
 			/* This is my hack from setpwnam.c -janl */
 			while (buf[len-1] != '\n' && !feof(fp)) {
-				wchar_t *x;
-
 				/* Extend input buffer if it failed getting the whole line */
-
 				/* So now we double the buffer size */
 				bufsiz *= 2;
 
-				x = realloc(buf, bufsiz * sizeof(wchar_t));
-				if (!x) {
-					free(buf);
-					err(EXIT_FAILURE, _("realloc failed"));
-				}
-				buf = x;
+				buf = xrealloc(buf, bufsiz * sizeof(wchar_t));
 
 				/* And fill the rest of the buffer */
 				if (!fgetws(&buf[len], bufsiz/2, fp))
-- 
1.7.4.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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