shithub: plan9front

Download patch

ref: c3b30544e19f54020ddc364b02e5202bb465cec6
parent: fd1db35c4d429096b9aff1763f25de9e1711bf88
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Jan 1 14: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	Tue Dec 29 14:38:59 2020
+++ b/sys/src/cmd/sort.c	Fri Jan  1 14:48:39 2021
@@ -209,6 +209,8 @@
 			free(ol);
 			ol = l;
 		}
+		free(ol->key);
+		free(ol);
 		return;
 	}