The destructor code in ui-out.c has a latent bug, which is hidden by
the fact that nothing uses this right now. This patch fixes the
problem. The bug is that we don't always clear a pointer in the
ui-out object, leading to a bad free.
2014-03-17 Tom Tromey <tromey@redhat.com>
* ui-out.c (clear_table, ui_out_new): Clear uiout->table.id.
+2014-03-17 Tom Tromey <tromey@redhat.com>
+
+ * ui-out.c (clear_table, ui_out_new): Clear uiout->table.id.
+
2014-03-17 Pierre-Marie de Rodat <derodat@adacore.com>
* ada-lang.c (decode_constrained_packed_array): Perform a
static void
clear_table (struct ui_out *uiout)
{
- if (uiout->table.id)
- xfree (uiout->table.id);
+ xfree (uiout->table.id);
+ uiout->table.id = NULL;
clear_header_list (uiout);
}
current->field_count = 0;
VEC_safe_push (ui_out_level_p, uiout->levels, current);
+ uiout->table.id = NULL;
uiout->table.header_first = NULL;
uiout->table.header_last = NULL;
uiout->table.header_next = NULL;