ref: ba9a0448fde8f4fd42ef21a6c562f75570418257
parent: e03befa50d9e87945a96154e6ab3c503095406f7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jul 2 15:37:04 EDT 2025
kernel: fix memory leak in procctlmemio() Only take a reference of the segment after smalloc() succeeded, as smalloc() can error(), so we'd leak the segment.
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -1672,7 +1672,6 @@
} else {
qunlock(s);
}
- incref(s); /* for us while we copy */
poperror();
sio = c->aux;
if(sio == nil){
@@ -1679,6 +1678,7 @@
sio = smalloc(sizeof(Segio));
c->aux = sio;
}
+ incref(s); /* for us while we copy */
qunlock(&p->seglock);
poperror();
--
⑨