Index: src/hid/common/flags.c =================================================================== --- src/hid/common/flags.c (revision 1278) +++ src/hid/common/flags.c (revision 1279) @@ -72,6 +72,15 @@ void hid_flags_uninit(void) { if (hid_flags != NULL) { + htsp_entry_t *e; + for(e = htsp_first(hid_flags); e; e = htsp_next(hid_flags, e)) { + HID_FlagNode *ha; + ha = e->value; + if (ha->cookie != NULL) + fprintf(stderr, "Warning: uninitialized flag in hid_flags_uninit: %s by %s; check your plugins' uninit!\n", e->key, ha->cookie); + htsp_pop(hid_flags, e->key); + free(ha); + } htsp_free(hid_flags); hid_flags = NULL; } Index: src/hid/common/hidinit.c =================================================================== --- src/hid/common/hidinit.c (revision 1278) +++ src/hid/common/hidinit.c (revision 1279) @@ -149,6 +149,7 @@ hid_actions_uninit(); hid_flags_uninit(); + hid_attributes_uninit(); } void hid_register_hid(HID * hid) @@ -257,6 +258,19 @@ ha->cookie = cookie; } +void hid_attributes_uninit(void) +{ + HID_AttrNode *ha, *next; + for (ha = hid_attr_nodes; ha; ha = next) { + next = ha->next; + if (ha->cookie != NULL) + fprintf(stderr, "WARNING: attribute %s by %s is not uninited, check your plugins' uninit!\n", ha->attributes->name, ha->cookie); + free(ha); + } + hid_attr_nodes = NULL; +} + + void hid_parse_command_line(int *argc, char ***argv) { HID_AttrNode *ha; Index: src/hid.h =================================================================== --- src/hid.h (revision 1278) +++ src/hid.h (revision 1279) @@ -194,6 +194,9 @@ #define REGISTER_ATTRIBUTES(a, cookie) HIDCONCAT(void register_,a) ()\ { hid_register_attributes(a, sizeof(a)/sizeof(a[0]), cookie); } + /* remove all attributes and free the list */ + void hid_attributes_uninit(void); + /* These three are set by hid_parse_command_line(). */ extern char *program_name; extern char *program_directory;