From 9dc44bf8c427160bafd87205c42201cf9b11c0b4 Mon Sep 17 00:00:00 2001 From: Emanuele Torre Date: Tue, 12 Jan 2021 00:58:07 +0100 Subject: [PATCH] wc: Remove a memory leak. --- Userland/wc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/wc.cpp b/Userland/wc.cpp index 0cdeb0ad468..cf9fa62d359 100644 --- a/Userland/wc.cpp +++ b/Userland/wc.cpp @@ -85,6 +85,10 @@ static Count get_count(const String& file_specifier) count.words++; } } + + if (file_pointer != stdin) + fclose(file_pointer); + return count; }