code: plan9front

Download patch

ref: cd5bafe7cbb4736ed53745e288bac44020902f13
parent: 87a6e1873b3ebd90a6cc075b3a833cca5b675f1a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Feb 17 06:41:59 EST 2023

devproc: Fix a double-free reading note file (thanks Josiah Frentsos)

Oversight, was using free() instead of freenote(),
which handles the refcounting for gorup notes.

--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -1127,7 +1127,7 @@
 				n = i;
 			memmove(va, p->note[0]->msg, n-1);
 			((char*)va)[n-1] = '\0';
-			free(p->note[0]);
+			freenote(p->note[0]);
 			if(--p->nnote == 0)
 				p->notepending = 0;
 			else