If an attribute already exists replace its value rather then adding a duplicate attribute with the new value to the list.
Signed-off-by: Hans de Goede <[email protected]> --- config/config.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/config.c b/config/config.c index 64dfb88..aaef746 100644 --- a/config/config.c +++ b/config/config.c @@ -163,11 +163,14 @@ config_odev_add_attribute(struct OdevAttributes *attribs, int attrib, { struct OdevAttribute *oa; - oa = malloc(sizeof(struct OdevAttribute)); + oa = config_odev_find_attribute(attribs, attrib); + if (!oa) + oa = calloc(1, sizeof(struct OdevAttribute)); if (!oa) return FALSE; oa->attrib_id = attrib; + free(oa->attrib_name); oa->attrib_name = strdup(attrib_name); xorg_list_append(&oa->member, &attribs->list); return TRUE; -- 1.8.5.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
