[PATCH] libbb: don't ignore result of xrealloc

Daniel Glöckner dg at emlix.com
Fri May 15 15:57:13 UTC 2009


Even on single byte expansions the pointer may change.

Signed-off-by: Daniel Glöckner <dg at emlix.com>
---
 libbb/read.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libbb/read.c b/libbb/read.c
index a0c0cc6..b58982b 100644
--- a/libbb/read.c
+++ b/libbb/read.c
@@ -229,7 +229,7 @@ void* FAST_FUNC xmalloc_read(int fd, size_t *maxsz_p)
 		if (size > 64*1024)
 			size = 64*1024;
 	}
-	xrealloc(buf, total + 1);
+	buf = xrealloc(buf, total + 1);
 	buf[total] = '\0';
 
 	if (maxsz_p)
@@ -273,7 +273,7 @@ void* FAST_FUNC xmalloc_open_read_close(const char *filename, size_t *maxsz_p)
 		free(buf);
 		return NULL;
 	}
-	xrealloc(buf, size + 1);
+	buf = xrealloc(buf, size + 1);
 	buf[size] = '\0';
 
 	if (maxsz_p)
-- 
1.6.1.3



More information about the busybox mailing list