[gnome-desktop/gnome-2-30] Fix possible double-free when destroying private windows



commit 9c5f91b59a0a17b8bed1a8f83c1de763354bcebc
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Nov 11 13:21:21 2010 +0000

    Fix possible double-free when destroying private windows
    
    This could cause free'ing random data when the members of ->windows
    were destroyed, but ->windows itself wasn't. As it was != NULL, we'd
    be free memory that wouldn't belong to us anymore.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=634534

 libgnome-desktop/gnome-rr-labeler.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-rr-labeler.c b/libgnome-desktop/gnome-rr-labeler.c
index 4988fda..da4adbd 100644
--- a/libgnome-desktop/gnome-rr-labeler.c
+++ b/libgnome-desktop/gnome-rr-labeler.c
@@ -287,11 +287,16 @@ gnome_rr_labeler_hide (GnomeRRLabeler *labeler)
 
 	g_return_if_fail (GNOME_IS_RR_LABELER (labeler));
 
+	if (labeler->windows == NULL)
+		return;
+
 	for (i = 0; i < labeler->num_outputs; i++)
 		if (labeler->windows[i] != NULL) {
 			gtk_widget_destroy (labeler->windows[i]);
 			labeler->windows[i] = NULL;
 		}
+	g_free (labeler->windows);
+	labeler->windows = NULL;
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]