From: Karel Zak Date: Wed, 27 Mar 2013 15:16:46 +0000 (+0100) Subject: pg: fix memory leak [coverity scan] X-Git-Tag: v2.23-rc2~92 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=765056b37265da3bc367899f54f833210a2cc2df;p=thirdparty%2Futil-linux.git pg: fix memory leak [coverity scan] Signed-off-by: Karel Zak --- diff --git a/text-utils/pg.c b/text-utils/pg.c index ab7a85a958..c00b7371f3 100644 --- a/text-utils/pg.c +++ b/text-utils/pg.c @@ -569,8 +569,10 @@ static int getcount(char *cmdstr) } else *(buf + strlen(buf) - 1) = '\0'; } - if (*buf == '\0') + if (*buf == '\0') { + free(buf); return 1; + } if (buf[0] == '-' && buf[1] == '\0') { i = -1; } else {