]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: fix resource leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Mon, 30 Jan 2012 22:47:27 +0000 (23:47 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 30 Jan 2012 22:49:23 +0000 (23:49 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt.c

index 3990f63b96f30cb24b25580937b4b5d2b00651aa..083cfea2caf7a562f827fc9390d442777c9cb7bf 100644 (file)
@@ -707,7 +707,7 @@ static int poll_match(struct libmnt_fs *fs)
 static int poll_table(struct libmnt_table *tb, const char *tabfile,
                  int timeout, struct tt *tt, int direction)
 {
-       FILE *f;
+       FILE *f = NULL;
        int rc = -1;
        struct libmnt_iter *itr = NULL;
        struct libmnt_table *tb_new = NULL;
@@ -807,6 +807,8 @@ done:
        mnt_free_table(tb_new);
        mnt_free_tabdiff(diff);
        mnt_free_iter(itr);
+       if (f)
+               fclose(f);
        return rc;
 }