[Commit] xrtest xrknockout.c,1.5,1.6

commit@keithp.com commit@keithp.com
Wed, 23 Apr 2003 08:37:46 -0700


Committed by: cworth

Update of /local/src/CVS/xrtest
In directory home.keithp.com:/tmp/cvs-serv20859

Modified Files:
	xrknockout.c 
Log Message:
Fixed some memory leaks

Index: xrknockout.c
===================================================================
RCS file: /local/src/CVS/xrtest/xrknockout.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xrknockout.c	22 Apr 2003 23:07:08 -0000	1.5
+++ xrknockout.c	23 Apr 2003 15:37:44 -0000	1.6
@@ -211,6 +211,10 @@
 
     XrShowSurface (r, overlay, 0, 0, width, height);
 
+    XrSurfaceDestroy (overlay);
+    XrSurfaceDestroy (punch);
+    XrSurfaceDestroy (circles);
+
 }
 
 static void
@@ -316,10 +320,10 @@
       switch (xev.xany.type) {
       case ButtonPress:
           /* A click on the canvas ends the program */
-          return 0;
+          goto DONE;
       case KeyPress:
           if (xev.xkey.keycode == quit_keycode)
-              return 0;
+              goto DONE;
       case ConfigureNotify:
           /* Note new size */
 	  width = xev.xconfigure.width;
@@ -340,6 +344,10 @@
 	  break;
       }
   }
+  DONE:
+
+  XDestroyRegion (update_region);
+  XCloseDisplay (dpy);
 
   return 0;
 }