X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fapple2-main.c;h=facaf7173f1526cf65e22a0086289168162df560;hb=5f1f12f2a37da634000f96d18d59cc73a8814ef7;hp=28fef9aa446cfc77a3ea5e890ecbb299f8495004;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/apple2-main.c b/hacks/apple2-main.c index 28fef9aa..facaf717 100644 --- a/hacks/apple2-main.c +++ b/hacks/apple2-main.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1998-2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 1998-2010 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -27,6 +27,7 @@ #ifndef HAVE_COCOA # define XK_MISCELLANY # include +# include # include # include #endif @@ -568,6 +569,9 @@ image_loaded_cb (Screen *screen, Window window, Drawable p, image (regardless of whether it started as TrueColor/PseudoColor.) */ pick_a2_subimage (dpy, window, image, buf32, w, h); + free(image->data); + image->data = 0; + XDestroyImage(image); /* Then dither the 32bpp image to a 6-color Apple][ colormap. */ @@ -783,6 +787,7 @@ static void slideshow_controller(apple2_sim_t *sim, int *stepno, free(mine->render_img); free(mine->img_filename); free(mine); + mine = 0; return; } @@ -904,6 +909,9 @@ launch_text_generator (struct terminal_controller_data *mine) sprintf (buf, "%.100s: %.100s", progname, program); perror(buf); } + + free(oprogram); + free(program); } static void @@ -943,7 +951,10 @@ terminal_read(struct terminal_controller_data *mine, unsigned char *buf, int n) return 1; } - if (!mine->input_available_p) return 0; + if (!mine || + !mine->input_available_p || + !mine->pipe) + return 0; rc=read (fileno (mine->pipe), (void *) buf, n); if (rc>0) mine->lastc=buf[rc-1]; @@ -1522,6 +1533,7 @@ terminal_controller(apple2_sim_t *sim, int *stepno, double *next_actiontime) case A2CONTROLLER_FREE: terminal_closegen(mine); free(mine); + mine = 0; return; } } @@ -1884,6 +1896,7 @@ basic_controller(apple2_sim_t *sim, int *stepno, double *next_actiontime) case A2CONTROLLER_FREE: free(mine); + mine = 0; break; }