Index: trunk/src/obj_arc.c =================================================================== --- trunk/src/obj_arc.c (revision 30962) +++ trunk/src/obj_arc.c (revision 30963) @@ -294,6 +294,7 @@ pcb_r_delete_entry(arc->parent.layer->arc_tree, (rnd_box_t *)arc); rnd_attribute_free(&arc->Attributes); pcb_arc_unreg(arc); + pcb_obj_common_free((pcb_any_obj_t *)arc); free(arc); } Index: trunk/src/obj_common.c =================================================================== --- trunk/src/obj_common.c (revision 30962) +++ trunk/src/obj_common.c (revision 30963) @@ -428,3 +428,11 @@ Pnt->X2 = Pnt->X + 1; Pnt->Y2 = Pnt->Y + 1; } + +void pcb_obj_common_free(pcb_any_obj_t *o) +{ + if (o->override_color != NULL) { + free(o->override_color); + o->override_color = NULL; + } +} Index: trunk/src/obj_common.h =================================================================== --- trunk/src/obj_common.h (revision 30962) +++ trunk/src/obj_common.h (revision 30963) @@ -231,7 +231,7 @@ unsigned int noexport:1; \ unsigned int noexport_named:1; \ unsigned int extobj_editing:1; \ - const rnd_color_t *override_color + rnd_color_t *override_color /* Lines, pads, and rats all use this so they can be cross-cast. */ #define PCB_ANYLINEFIELDS \ @@ -278,6 +278,8 @@ /* sets the bounding box of a point */ void pcb_set_point_bounding_box(pcb_point_t *Pnt); +void pcb_obj_common_free(pcb_any_obj_t *o); + /* Determine the size class of a sub-kilobyte object: the largest 2^n that is smaller than the size; size must be at least 16. */ #define pcb_size_class(a) ((a) < 32 ? 16 : ((a) < 64 ? 32 : ((a) < 128 ? 64 : ((a) < 256 ? 128 : ((a) < 512 ? 256 : ((a) < 1024 ? 512 : 1024 )))))) Index: trunk/src/obj_gfx.c =================================================================== --- trunk/src/obj_gfx.c (revision 30962) +++ trunk/src/obj_gfx.c (revision 30963) @@ -198,6 +198,7 @@ pcb_r_delete_entry(gfx->parent.layer->gfx_tree, (rnd_box_t *)gfx); rnd_attribute_free(&gfx->Attributes); pcb_gfx_unreg(gfx); + pcb_obj_common_free((pcb_any_obj_t *)gfx); free(gfx); } Index: trunk/src/obj_line.c =================================================================== --- trunk/src/obj_line.c (revision 30962) +++ trunk/src/obj_line.c (revision 30963) @@ -113,6 +113,7 @@ pcb_r_delete_entry(line->parent.layer->line_tree, (rnd_box_t *)line); rnd_attribute_free(&line->Attributes); pcb_line_unreg(line); + pcb_obj_common_free((pcb_any_obj_t *)line); free(line); } Index: trunk/src/obj_poly.c =================================================================== --- trunk/src/obj_poly.c (revision 30962) +++ trunk/src/obj_poly.c (revision 30963) @@ -112,6 +112,7 @@ pcb_r_delete_entry(poly->parent.layer->polygon_tree, (rnd_box_t *)poly); rnd_attribute_free(&poly->Attributes); pcb_poly_unreg(poly); + pcb_obj_common_free((pcb_any_obj_t *)poly); free(poly); } Index: trunk/src/obj_pstk.c =================================================================== --- trunk/src/obj_pstk.c (revision 30962) +++ trunk/src/obj_pstk.c (revision 30963) @@ -110,6 +110,7 @@ rnd_attribute_free(&ps->Attributes); pcb_pstk_unreg(ps); free(ps->thermals.shape); + pcb_obj_common_free((pcb_any_obj_t *)ps); free(ps); } Index: trunk/src/obj_rat.c =================================================================== --- trunk/src/obj_rat.c (revision 30962) +++ trunk/src/obj_rat.c (revision 30963) @@ -87,6 +87,7 @@ pcb_rat_unreg(rat); free(rat->anchor[0]); free(rat->anchor[1]); + pcb_obj_common_free((pcb_any_obj_t *)rat); free(rat); } Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 30962) +++ trunk/src/obj_subc.c (revision 30963) @@ -141,6 +141,7 @@ pcb_subc_unreg(sc); pcb_data_free(sc->data); pcb_term_uninit(&sc->terminals); + pcb_obj_common_free((pcb_any_obj_t *)sc); free(sc); } Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 30962) +++ trunk/src/obj_text.c (revision 30963) @@ -109,6 +109,7 @@ rnd_attribute_free(&text->Attributes); pcb_text_unreg(text); free(text->TextString); + pcb_obj_common_free((pcb_any_obj_t *)text); free(text); }