shithub: riscv

Download patch

ref: c3b30544e19f54020ddc364b02e5202bb465cec6
parent: fd1db35c4d429096b9aff1763f25de9e1711bf88
author: Ori Bernstein <[email protected]>
date: Fri Jan 1 06:48:39 EST 2021

sort: fix memory leak (thanks Igor Boehm)

Free the last line that we examine when looping
through the lines in a file.

--- a/sys/src/cmd/sort.c
+++ b/sys/src/cmd/sort.c
@@ -209,6 +209,8 @@
 			free(ol);
 			ol = l;
 		}
+		free(ol->key);
+		free(ol);
 		return;
 	}