Mercurial > hg > xemacs-beta
changeset 3482:20773f9b7bc0
[xemacs-hg @ 2006-06-29 16:58:59 by james]
Check scrollbar instance data for NULLness before dereferencing.
<m31wt77vcf.fsf@jerrypc.cs.usu.edu>
author | james |
---|---|
date | Thu, 29 Jun 2006 16:59:00 +0000 |
parents | 71532ccbd8e3 |
children | ec4465d7e449 |
files | src/ChangeLog src/scrollbar-gtk.c src/scrollbar-msw.c |
diffstat | 3 files changed, 27 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Thu Jun 29 14:52:00 2006 +0000 +++ b/src/ChangeLog Thu Jun 29 16:59:00 2006 +0000 @@ -1,3 +1,10 @@ +2006-06-29 Jerry James <james@xemacs.org> + + * scrollbar-gtk.c (gtk_free_scrollbar_instance): Compare + instance->scrollbar_data against NULL before using it. + * scrollbar-msw.c (mswindows_free_scrollbar_instance): Compare + sb->scrollbar_data against NULL before using it. + 2006-06-22 Jerry James <james@xemacs.org> * redisplay-gtk.c (gtk_output_display_block): Fix a Dynarr leak.
--- a/src/scrollbar-gtk.c Thu Jun 29 14:52:00 2006 +0000 +++ b/src/scrollbar-gtk.c Thu Jun 29 16:59:00 2006 +0000 @@ -56,14 +56,16 @@ static void gtk_free_scrollbar_instance (struct scrollbar_instance *instance) { - if (SCROLLBAR_GTK_WIDGET (instance)) + if (instance->scrollbar_data) { - gtk_widget_hide_all (SCROLLBAR_GTK_WIDGET (instance)); - gtk_widget_destroy (SCROLLBAR_GTK_WIDGET (instance)); + if (SCROLLBAR_GTK_WIDGET (instance)) + { + gtk_widget_hide_all (SCROLLBAR_GTK_WIDGET (instance)); + gtk_widget_destroy (SCROLLBAR_GTK_WIDGET (instance)); + } + + xfree (instance->scrollbar_data, void *); } - - if (instance->scrollbar_data) - xfree (instance->scrollbar_data, void *); } /* A device method. */
--- a/src/scrollbar-msw.c Thu Jun 29 14:52:00 2006 +0000 +++ b/src/scrollbar-msw.c Thu Jun 29 16:59:00 2006 +0000 @@ -90,17 +90,19 @@ static void mswindows_free_scrollbar_instance (struct scrollbar_instance *sb) { - void *opaque = - (void *) qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA); - Lisp_Object ptr; + if (sb->scrollbar_data) + { + void *opaque = + (void *) qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA); + Lisp_Object ptr; - ptr = VOID_TO_LISP (opaque); - assert (OPAQUE_PTRP (ptr)); - ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table); - assert (!NILP (ptr)); - DestroyWindow (SCROLLBAR_MSW_HANDLE (sb)); - if (sb->scrollbar_data) - xfree (sb->scrollbar_data, void *); + ptr = VOID_TO_LISP (opaque); + assert (OPAQUE_PTRP (ptr)); + ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table); + assert (!NILP (ptr)); + DestroyWindow (SCROLLBAR_MSW_HANDLE (sb)); + xfree (sb->scrollbar_data, void *); + } } static void