From e1972fc21b28151b787eef5baa151ddee424f550 Mon Sep 17 00:00:00 2001 From: Mamoru Tasaka Date: Feb 05 2010 06:18:41 +0000 Subject: - Fix memleak on analogtv based hacks, especially on apple2 --- diff --git a/xscreensaver-5.10-apple2-memleak.patch b/xscreensaver-5.10-apple2-memleak.patch new file mode 100644 index 0000000..9ca6139 --- /dev/null +++ b/xscreensaver-5.10-apple2-memleak.patch @@ -0,0 +1,76 @@ +--- xscreensaver-5.10/hacks/analogtv.c.meml 2010-02-05 05:47:34.000000000 +0900 ++++ xscreensaver-5.10/hacks/analogtv.c 2010-02-05 05:47:34.000000000 +0900 +@@ -494,6 +494,8 @@ analogtv_release(analogtv *it) + it->gc=NULL; + if (it->n_colors) XFreeColors(it->dpy, it->colormap, it->colors, it->n_colors, 0L); + it->n_colors=0; ++ /* also free it itself */ ++ free(it); + } + + +--- xscreensaver-5.10/hacks/apple2-main.c.meml 2008-02-10 10:34:37.000000000 +0900 ++++ xscreensaver-5.10/hacks/apple2-main.c 2010-02-05 05:47:34.000000000 +0900 +@@ -569,6 +569,10 @@ image_loaded_cb (Screen *screen, Window + image (regardless of whether it started as TrueColor/PseudoColor.) + */ + pick_a2_subimage (dpy, window, image, buf32, w, h); ++ /* destroy image */ ++ free(image->data); ++ image->data = 0; ++ XDestroyImage(image); + + /* Then dither the 32bpp image to a 6-color Apple][ colormap. + */ +@@ -905,6 +909,9 @@ launch_text_generator (struct terminal_c + sprintf (buf, "%.100s: %.100s", progname, program); + perror(buf); + } ++ ++ free(oprogram); ++ free(program); + } + + static void +--- xscreensaver-5.10/hacks/apple2.c.meml 2006-03-27 14:45:53.000000000 +0900 ++++ xscreensaver-5.10/hacks/apple2.c 2010-02-05 05:47:34.000000000 +0900 +@@ -702,7 +702,18 @@ apple2_one_frame (apple2_sim_t *sim) + + XClearWindow(sim->dpy, sim->window); + +- /* #### free sim? */ ++ /* free sim */ ++ /* This is from a2_make_font */ ++ free(sim->text_im->data); ++ sim->text_im->data = 0; ++ XDestroyImage(sim->text_im); ++ ++ /* And free else */ ++ analogtv_release(sim->dec); ++ free(sim->st); ++ free(sim->inp); ++ free(sim); ++ + return 0; + } + +--- xscreensaver-5.10/utils/grabclient.c.meml 2008-02-10 10:57:56.000000000 +0900 ++++ xscreensaver-5.10/utils/grabclient.c 2010-02-05 14:19:03.000000000 +0900 +@@ -238,6 +238,7 @@ hack_subproc_environment (Display *dpy) + */ + const char *odpy = DisplayString (dpy); + char *ndpy = (char *) malloc(strlen(odpy) + 20); ++ static char *old_ndpy; + strcpy (ndpy, "DISPLAY="); + strcat (ndpy, odpy); + +@@ -246,6 +247,9 @@ hack_subproc_environment (Display *dpy) + #ifdef HAVE_PUTENV + if (putenv (ndpy)) + abort (); ++ ++ free(old_ndpy); ++ old_ndpy = ndpy; + #endif /* HAVE_PUTENV */ + } + diff --git a/xscreensaver.spec b/xscreensaver.spec index 400871a..bdd3ca2 100644 --- a/xscreensaver.spec +++ b/xscreensaver.spec @@ -5,7 +5,7 @@ %define modular_conf 1 -%define fedora_rel 5 +%define fedora_rel 6 %define extrarel %{nil} @@ -53,6 +53,7 @@ Patch31: xscreensaver-5.10-apple2-initialization.patch # Not sent to upstream yet, must do later # bug 560614 Patch32: xscreensaver-5.10-noseguy-segv-with-nofont.patch +Patch33: xscreensaver-5.10-apple2-memleak.patch # # Patches end Requires: xscreensaver-base = %{epoch}:%{version}-%{release} @@ -210,6 +211,7 @@ This package contains some test programs to debug XScreenSaver. %patch30 -p1 -b .subst %patch31 -p1 -b .apple %patch32 -p1 -b .noseguy +%patch33 -p1 -b .meml change_option(){ set +x @@ -679,6 +681,9 @@ exit 0 %defattr(-,root,root,-) %changelog +* Fri Feb 5 2010 Mamoru Tasaka - 1:5.10-6 +- Fix memleak on analogtv based hacks, especially on apple2 + * Wed Feb 3 2010 Mamoru Tasaka - 1:5.10-5 - Fix crash on noseguy when X resource is no longer available (bug 560614)