summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xreadlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index 4d87b94..98b795f 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -18,7 +18,8 @@ char *xmalloc_readlink(const char *path)
int bufsize = 0, readsize = 0;
do {
- buf = xrealloc(buf, bufsize += GROWBY);
+ bufsize += GROWBY;
+ buf = xrealloc(buf, bufsize);
readsize = readlink(path, buf, bufsize);
if (readsize == -1) {
free(buf);