summaryrefslogtreecommitdiffstats
path: root/text-utils/more.c
diff options
context:
space:
mode:
authorKarel Zak2014-01-14 17:49:34 +0100
committerKarel Zak2014-01-14 17:54:57 +0100
commitb9579f1f44b46c9f12f1e01b01c02d82ae1cf728 (patch)
treea65d30323009a4eacc44be9292725fcb86834c1c /text-utils/more.c
parentpylibmount: import directly from pylibmount in tests (diff)
downloadkernel-qcow2-util-linux-b9579f1f44b46c9f12f1e01b01c02d82ae1cf728.tar.gz
kernel-qcow2-util-linux-b9579f1f44b46c9f12f1e01b01c02d82ae1cf728.tar.xz
kernel-qcow2-util-linux-b9579f1f44b46c9f12f1e01b01c02d82ae1cf728.zip
more: fix mem leak [coverity scan]
... the code is so soo ugly. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/more.c')
-rw-r--r--text-utils/more.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/text-utils/more.c b/text-utils/more.c
index da5439b4a..4c39887e9 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -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');