Index: trunk/src/attrib.c =================================================================== --- trunk/src/attrib.c (revision 27935) +++ trunk/src/attrib.c (revision 27936) @@ -59,9 +59,10 @@ /* Replace an existing attribute if there is a name match. */ for (i = 0; i < list->Number; i++) { if (strcmp(name, list->List[i].name) == 0) { - free(list->List[i].value); + char *old_value = list->List[i].value; list->List[i].value = pcb_strdup_null(value); NOTIFY(list, list->List[i].name, list->List[i].value); + free(old_value); return 1; } } @@ -146,9 +147,10 @@ if (strcmp(name, dst->List[i].name) == 0) { dst->List[i].cpb_written = 1; if (strcmp(value, dst->List[i].value) != 0) { - free(dst->List[i].value); + char *old_value = dst->List[i].value; dst->List[i].value = pcb_strdup(value); NOTIFY(dst, dst->List[i].name, dst->List[i].value); + free(old_value); } return; } Index: trunk/src/attrib.h =================================================================== --- trunk/src/attrib.h (revision 27935) +++ trunk/src/attrib.h (revision 27936) @@ -42,7 +42,7 @@ struct pcb_attribute_list_s { int Number, Max; pcb_attribute_t *List; - void (*post_change)(pcb_attribute_list_t *list, const char *name, const char *value); /* called after put or remove, but not after free(); value is NULL if removed */ + void (*post_change)(pcb_attribute_list_t *list, const char *name, const char *value); /* called after put or remove, but not after free(); value is NULL if removed; old value is free'd only after the call so cached old values are valid */ }; /* Returns NULL if the name isn't found, else the value for that named