]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
pg: fix memory leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 15:16:46 +0000 (16:16 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 15:16:46 +0000 (16:16 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/pg.c

index ab7a85a9585fd0dc302ac064f277fe7ba1071061..c00b7371f3aaedded7659f32f86f80e8254f36ed 100644 (file)
@@ -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 {