shithub: riscv

Download patch

ref: 2e717a555727bef3c08450576426c2a1d7b07dda
parent: 1f8d347c92a948bafde638c4864bc46096058dd3
author: qwx <devnull@localhost>
date: Sun May 20 12:47:41 EDT 2018

camv: fix leak on resize

--- a/sys/src/cmd/camv.c
+++ b/sys/src/cmd/camv.c
@@ -39,8 +39,9 @@
 void
 screeninit(void)
 {
-	bg = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0xCCCCCCFF);
+	freescreen(scr);
 	scr = allocscreen(screen, bg, 0);
+	freeimage(disp);
 	disp = allocwindow(scr, screen->r, 0, 0xCCCCCCFF);
 	draw(screen, screen->r, bg, nil, ZP);
 	flushimage(display, 1);
@@ -225,6 +226,7 @@
 	
 	if(initdraw(nil, nil, "camv") < 0)
 		sysfatal("initdraw: %r");
+	bg = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0xCCCCCCFF);
 	screeninit();
 	kc = initkeyboard(nil);
 	if(kc == nil) sysfatal("initkeyboard: %r");