From c3b30544e19f54020ddc364b02e5202bb465cec6 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Fri, 1 Jan 2021 11:48:39 -0800 Subject: [PATCH] sort: fix memory leak (thanks Igor Boehm) Free the last line that we examine when looping through the lines in a file. --- sys/src/cmd/sort.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/src/cmd/sort.c b/sys/src/cmd/sort.c index 0cc207174..e613f185e 100644 --- a/sys/src/cmd/sort.c +++ b/sys/src/cmd/sort.c @@ -209,6 +209,8 @@ dofile(Biobuf *b) free(ol); ol = l; } + free(ol->key); + free(ol); return; }