shithub: riscv

Download patch

ref: 567b1b912a91bf56bebacc67b6a467986d5bed6c
parent: ff30a7743b2d9bc388067f77b6aa6f5d2c7bc210
author: Jacob Moody <moody@posixcafe.org>
date: Sun Apr 21 14:40:08 EDT 2024

rio: fix memory leak with closed kbdtap (thanks aap)

--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -352,7 +352,7 @@
 {
 	Window *cur = nil;
 	Channel *c;
-	char *s;
+	char *s, *t;
 
 	enum { Akbd, Aopen, Aclose, Awrite, NALT };
 	Alt alts[NALT+1] = {
@@ -397,6 +397,8 @@
 			}
 			if(c == totap)
 				totap = nil;
+			while(nbrecv(c, &t))
+				free(t);
 			chanfree(c);
 			break;
 		case Awrite: