]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
more: fix mem leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 14 Jan 2014 16:49:34 +0000 (17:49 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Jan 2014 16:54:57 +0000 (17:54 +0100)
... the code is so soo ugly.

Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/more.c

index da5439b4a52e01b43e727ff14dd51c3294d1a75e..4c39887e9ea8fc4c7445f069a1e7b9289d2ac3e0 100644 (file)
@@ -604,8 +604,10 @@ FILE *checkf(register char *fs, int *clearfirst)
                perror(fs);
                return ((FILE *)NULL);
        }
-       if (magic(f, fs))
+       if (magic(f, fs)) {
+               fclose(f);
                return ((FILE *)NULL);
+       }
        fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
        c = Getc(f);
        *clearfirst = (c == '\f');