summaryrefslogtreecommitdiffstats
path: root/text-utils/pg.c
diff options
context:
space:
mode:
authorKarel Zak2013-03-27 16:16:46 +0100
committerKarel Zak2013-03-27 16:16:46 +0100
commit765056b37265da3bc367899f54f833210a2cc2df (patch)
tree176b6ec1ab63d31307d8d49b6111dda0d4bbf916 /text-utils/pg.c
parentlibfdisk: (gpt) fix memory leak [coverity scan] (diff)
downloadkernel-qcow2-util-linux-765056b37265da3bc367899f54f833210a2cc2df.tar.gz
kernel-qcow2-util-linux-765056b37265da3bc367899f54f833210a2cc2df.tar.xz
kernel-qcow2-util-linux-765056b37265da3bc367899f54f833210a2cc2df.zip
pg: fix memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/pg.c')
-rw-r--r--text-utils/pg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/text-utils/pg.c b/text-utils/pg.c
index ab7a85a95..c00b7371f 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 {