]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
kill: fix fd leak
authorKarel Zak <kzak@redhat.com>
Wed, 1 Feb 2012 13:03:20 +0000 (14:03 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Feb 2012 13:03:20 +0000 (14:03 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/procs.c

index b09d538a9cdd7fd9e69541b11216182e21c8a217..e76c3908db0247bea15ba643e48ebf96c9eef1be 100644 (file)
@@ -69,8 +69,8 @@ get_pids (char *process_name, int get_all) {
            fp = fopen (fname, "r");
            if (! fp) continue;
            cp = fgets (buf, sizeof (buf), fp);
-           if (cp == NULL) continue;
            fclose (fp);
+           if (cp == NULL) continue;
            cp = parse_parens (buf);
            if (cp == NULL) continue;
        }