code: plan9front

Download patch

ref: 80d256149b5dbef1f435df2ebb188f3572613225
parent: 2bfd510b44593e0e2219017eda0f221b86016d1f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jan 22 15:46:06 EST 2023

lock: Fix some memory leaks (thanks steve simon!)

--- a/sys/src/cmd/lock.c
+++ b/sys/src/cmd/lock.c
@@ -35,6 +35,7 @@
 		}
 		if (w->pid == pid)
 			return w;
+		free(w);
 	}
 }
 
@@ -141,7 +142,8 @@
 		error("wait");
 
 	postnote(PNPROC, lckpid, "die");
-	waitfor(lckpid);
+	free(waitfor(lckpid));
+
 	if(w->msg[0]){
 		p = utfrune(w->msg, ':');
 		if(p && p[1])