From e003ba87d14cee3b078e06374aa45cf6287f1e41 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Sat, 11 Jun 2005 02:28:04 +0000 Subject: [PATCH] Prevent using the address of a local variable as a hash key. (Bug #307209) 2005-06-10 Ryan Lortie * src/frames.c: Prevent using the address of a local variable as a hash key. (Bug #307209) * src/xprops.c (meta_prop_get_values): Fix a small leak in the case of a SYNC_COUNTER property value and HAVE_XSYNC not defined. (Bug #307214) --- ChangeLog | 9 +++++++++ src/frames.c | 10 +++++----- src/xprops.c | 7 ++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc2c9f93d..dfbc98b0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-06-10 Ryan Lortie + + * src/frames.c: Prevent using the address of a local variable + as a hash key. (Bug #307209) + + * src/xprops.c (meta_prop_get_values): Fix a small leak in the + case of a SYNC_COUNTER property value and HAVE_XSYNC not + defined. (Bug #307214) + 2005-06-07 Ray Strode Cleanup font data when done with it (bug 306720). diff --git a/src/frames.c b/src/frames.c index e37e48fa5..6c463902f 100644 --- a/src/frames.c +++ b/src/frames.c @@ -188,7 +188,7 @@ meta_frames_init (MetaFrames *frames) { GTK_WINDOW (frames)->type = GTK_WINDOW_POPUP; - frames->text_heights = g_hash_table_new (g_int_hash, g_int_equal); + frames->text_heights = g_hash_table_new (NULL, NULL); frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal); @@ -296,7 +296,7 @@ meta_frames_font_changed (MetaFrames *frames) if (g_hash_table_size (frames->text_heights) > 0) { g_hash_table_destroy (frames->text_heights); - frames->text_heights = g_hash_table_new (g_int_hash, g_int_equal); + frames->text_heights = g_hash_table_new (NULL, NULL); } /* Queue a draw/resize on all frames */ @@ -395,9 +395,9 @@ meta_frames_ensure_layout (MetaFrames *frames, meta_prefs_get_titlebar_font ()); size = pango_font_description_get_size (font_desc); - + if (g_hash_table_lookup_extended (frames->text_heights, - &size, + GINT_TO_POINTER (size), &key, &value)) { frame->text_height = GPOINTER_TO_INT (value); @@ -409,7 +409,7 @@ meta_frames_ensure_layout (MetaFrames *frames, gtk_widget_get_pango_context (widget)); g_hash_table_replace (frames->text_heights, - &size, + GINT_TO_POINTER (size), GINT_TO_POINTER (frame->text_height)); } diff --git a/src/xprops.c b/src/xprops.c index 155424a40..e5465b9b4 100644 --- a/src/xprops.c +++ b/src/xprops.c @@ -1143,10 +1143,15 @@ meta_prop_get_values (MetaDisplay *display, values[i].type = META_PROP_VALUE_INVALID; #else values[i].type = META_PROP_VALUE_INVALID; + if (results.prop) + { + XFree (results.prop); + results.prop = NULL; + } #endif break; } - + next: ++i; }