From b9579f1f44b46c9f12f1e01b01c02d82ae1cf728 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 14 Jan 2014 17:49:34 +0100 Subject: more: fix mem leak [coverity scan] ... the code is so soo ugly. Signed-off-by: Karel Zak --- text-utils/more.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'text-utils/more.c') 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'); -- cgit v1.2.3-55-g7522