=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/usbhidaction/usbhidaction.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/usbhidaction/usbhidaction.c 2008/06/26 05:42:21 1.10 --- src/usr.bin/usbhidaction/usbhidaction.c 2009/10/14 20:36:56 1.11 *************** *** 1,4 **** ! /* $OpenBSD: usbhidaction.c,v 1.10 2008/06/26 05:42:21 ray Exp $ */ /* $NetBSD: usbhidaction.c,v 1.7 2002/01/18 14:38:59 augustss Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: usbhidaction.c,v 1.11 2009/10/14 20:36:56 guenther Exp $ */ /* $NetBSD: usbhidaction.c,v 1.7 2002/01/18 14:38:59 augustss Exp $ */ /* *************** *** 261,266 **** --- 261,267 ---- syslog(LOG_WARNING, "config file `%s', line %d" ", syntax error: %s", conf, line, buf); freecommands(cmds); + fclose(f); return (NULL); } else { errx(1, "config file `%s', line %d" *************** *** 286,291 **** --- 287,293 ---- "bad value: %s", conf, line, value); freecommands(cmds); + fclose(f); return (NULL); } else { errx(1, "config file `%s', line %d, " *************** *** 296,303 **** } coll[0] = 0; ! for (d = hid_start_parse(repd, 1 << hid_input, reportid); ! hid_get_item(d, &h); ) { if (verbose > 2) printf("kind=%d usage=%x\n", h.kind, h.usage); if (h.flags & HIO_CONST) --- 298,307 ---- } coll[0] = 0; ! d = hid_start_parse(repd, 1 << hid_input, reportid); ! if (d == NULL) ! err(1, "hid_start_parse failed"); ! while (hid_get_item(d, &h)) { if (verbose > 2) printf("kind=%d usage=%x\n", h.kind, h.usage); if (h.flags & HIO_CONST) *************** *** 349,363 **** --- 353,372 ---- break; } } + hid_end_parse(d); if (ignore) { if (verbose) warnx("ignore item '%s'", name); + /* pop and free this ignored item */ + cmds = cmd->next; + free(cmd); continue; } if (isdemon) { syslog(LOG_WARNING, "config file `%s', line %d, HID " "item not found: `%s'", conf, line, name); freecommands(cmds); + fclose(f); return (NULL); } else { errx(1, "config file `%s', line %d, HID item "