From: Yousong Zhou Date: Mon, 20 Mar 2017 02:46:15 +0000 (+0800) Subject: libbb: xreadlink: fix memory leak on failure case X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a9697267d937b18f89763c28f11a2e1b4018542;p=oweals%2Fopkg-lede.git libbb: xreadlink: fix memory leak on failure case Signed-off-by: Yousong Zhou --- diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 596a763..29949d1 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c @@ -25,6 +25,7 @@ extern char *xreadlink(const char *path) readsize = readlink(path, buf, bufsize); /* 1st try */ if (readsize == -1) { perror_msg("%s", path); + free(buf); return NULL; } }