shithub: riscv

Download patch

ref: b20ed3c1f5774fd333e889c72d2dbdfdeae02195
parent: 748bdc13b2697e3e86c5955d2eb39e1f7c40f93e
author: cinap_lenrek <[email protected]>
date: Mon Apr 30 09:03:00 EDT 2012

mothra/libpanel: fix memory leak in pledit

--- a/sys/src/cmd/mothra/libpanel/edit.c
+++ b/sys/src/cmd/mothra/libpanel/edit.c
@@ -209,6 +209,12 @@
 void pl_childspaceedit(Panel *g, Point *ul, Point *size){
 	USED(g, ul, size);
 }
+void pl_freeedit(Panel *p){
+	Edit *ep;
+	ep=p->data;
+	if(ep->t!=nil) twfree(ep->t);
+	ep->t=0;
+}
 void plinitedit(Panel *v, int flags, Point minsize, Rune *text, int ntext, void (*hit)(Panel *)){
 	Edit *ep;
 	ep=v->data;
@@ -219,6 +225,7 @@
 	v->type=pl_typeedit;
 	v->getsize=pl_getsizeedit;
 	v->childspace=pl_childspaceedit;
+	v->free=pl_freeedit;
 	v->kind="edit";
 	ep->hit=hit;
 	ep->minsize=minsize;