From: Sami Kerola Date: Sun, 7 Jul 2013 19:54:44 +0000 (+0100) Subject: agetty: fix memory leak [clang-analyzer] X-Git-Tag: v2.24-rc1~433 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3797cf255b78aba797db1566e52289f8d16b8238;p=thirdparty%2Futil-linux.git agetty: fix memory leak [clang-analyzer] Signed-off-by: Sami Kerola --- diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 4873891022..b7de618f1c 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)