From: Karel Zak Date: Tue, 14 Jan 2014 16:49:34 +0000 (+0100) Subject: more: fix mem leak [coverity scan] X-Git-Tag: v2.25-rc1~643 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9579f1f44b46c9f12f1e01b01c02d82ae1cf728;p=thirdparty%2Futil-linux.git more: fix mem leak [coverity scan] ... the code is so soo ugly. Signed-off-by: Karel Zak --- diff --git a/text-utils/more.c b/text-utils/more.c index da5439b4a5..4c39887e9e 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');