Prevent using the address of a local variable as a hash key. (Bug #307209)

2005-06-10  Ryan Lortie  <desrt@desrt.ca>

        * 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)
This commit is contained in:
Ryan Lortie 2005-06-11 02:28:04 +00:00 committed by Ryan Lortie
parent 064a86e620
commit e003ba87d1
3 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,12 @@
2005-06-10 Ryan Lortie <desrt@desrt.ca>
* 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 <rstrode@redhat.com> 2005-06-07 Ray Strode <rstrode@redhat.com>
Cleanup font data when done with it (bug 306720). Cleanup font data when done with it (bug 306720).

View File

@ -188,7 +188,7 @@ meta_frames_init (MetaFrames *frames)
{ {
GTK_WINDOW (frames)->type = GTK_WINDOW_POPUP; 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); 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) if (g_hash_table_size (frames->text_heights) > 0)
{ {
g_hash_table_destroy (frames->text_heights); 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 */ /* Queue a draw/resize on all frames */
@ -397,7 +397,7 @@ meta_frames_ensure_layout (MetaFrames *frames,
size = pango_font_description_get_size (font_desc); size = pango_font_description_get_size (font_desc);
if (g_hash_table_lookup_extended (frames->text_heights, if (g_hash_table_lookup_extended (frames->text_heights,
&size, GINT_TO_POINTER (size),
&key, &value)) &key, &value))
{ {
frame->text_height = GPOINTER_TO_INT (value); frame->text_height = GPOINTER_TO_INT (value);
@ -409,7 +409,7 @@ meta_frames_ensure_layout (MetaFrames *frames,
gtk_widget_get_pango_context (widget)); gtk_widget_get_pango_context (widget));
g_hash_table_replace (frames->text_heights, g_hash_table_replace (frames->text_heights,
&size, GINT_TO_POINTER (size),
GINT_TO_POINTER (frame->text_height)); GINT_TO_POINTER (frame->text_height));
} }

View File

@ -1143,6 +1143,11 @@ meta_prop_get_values (MetaDisplay *display,
values[i].type = META_PROP_VALUE_INVALID; values[i].type = META_PROP_VALUE_INVALID;
#else #else
values[i].type = META_PROP_VALUE_INVALID; values[i].type = META_PROP_VALUE_INVALID;
if (results.prop)
{
XFree (results.prop);
results.prop = NULL;
}
#endif #endif
break; break;
} }