diff options
author | Glenn L McGrath | 2004-08-11 03:50:30 +0000 |
---|---|---|
committer | Glenn L McGrath | 2004-08-11 03:50:30 +0000 |
commit | 18bbd9bf3b222eb85600f895c9a1f7dcb5f8ccef (patch) | |
tree | 30fdc91297c3c01324165ebc756e4ae31093dfab /libbb | |
parent | 73db8be80a2bca50e0d29a162f5d431f70e227c8 (diff) | |
download | busybox-18bbd9bf3b222eb85600f895c9a1f7dcb5f8ccef.zip busybox-18bbd9bf3b222eb85600f895c9a1f7dcb5f8ccef.tar.gz |
Patch from Tito to fix memory leak upon error.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xreadlink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 21a657d..49823fa 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c @@ -24,8 +24,9 @@ extern char *xreadlink(const char *path) buf = xrealloc(buf, bufsize += GROWBY); readsize = readlink(path, buf, bufsize); /* 1st try */ if (readsize == -1) { - bb_perror_msg("%s", path); - return NULL; + bb_perror_msg("%s", path); + free(buf); + return NULL; } } while (bufsize < readsize + 1); |