[PATCH 29/34] agetty: fix memory leak [clang-analyzer]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 term-utils/agetty.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 054a1dd..5a75433 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -463,9 +463,11 @@ static char *replace_u(char *str, char *username)
 		}
 		sz = strlen(str);
 
-		if (p == str && sz == 2)
+		if (p == str && sz == 2) {
 			/* 'str' contains only '\u' */
+			free(old);
 			return username;
+		}
 
 		tp = entry = malloc(sz + usz);
 		if (!tp)
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux