aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2004-08-11 03:50:30 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2004-08-11 03:50:30 +0000
commit18bbd9bf3b222eb85600f895c9a1f7dcb5f8ccef (patch)
tree30fdc91297c3c01324165ebc756e4ae31093dfab
parent73db8be80a2bca50e0d29a162f5d431f70e227c8 (diff)
downloadbusybox-w32-18bbd9bf3b222eb85600f895c9a1f7dcb5f8ccef.tar.gz
busybox-w32-18bbd9bf3b222eb85600f895c9a1f7dcb5f8ccef.tar.bz2
busybox-w32-18bbd9bf3b222eb85600f895c9a1f7dcb5f8ccef.zip
Patch from Tito to fix memory leak upon error.
-rw-r--r--libbb/xreadlink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index 21a657dfc..49823fa7f 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -24,8 +24,9 @@ extern char *xreadlink(const char *path)
24 buf = xrealloc(buf, bufsize += GROWBY); 24 buf = xrealloc(buf, bufsize += GROWBY);
25 readsize = readlink(path, buf, bufsize); /* 1st try */ 25 readsize = readlink(path, buf, bufsize); /* 1st try */
26 if (readsize == -1) { 26 if (readsize == -1) {
27 bb_perror_msg("%s", path); 27 bb_perror_msg("%s", path);
28 return NULL; 28 free(buf);
29 return NULL;
29 } 30 }
30 } 31 }
31 while (bufsize < readsize + 1); 32 while (bufsize < readsize + 1);