Hello, A few NULL checks before free() can be removed in uaudio. Immediately freeing the value returned by uaudio_io_terminaltype() seems a little strange but I didn't look into that further.
- Michael Index: uaudio.c =================================================================== RCS file: /cvs/src/sys/dev/usb/uaudio.c,v retrieving revision 1.129 diff -u -p -u -r1.129 uaudio.c --- uaudio.c 7 Jul 2018 13:03:08 -0000 1.129 +++ uaudio.c 23 Jul 2018 06:29:46 -0000 @@ -1353,8 +1353,7 @@ uaudio_io_terminaltype(int outtype, stru it->output = tml; if (it->inputs != NULL) { for (i = 0; i < it->inputs_size; i++) - if (it->inputs[i] != NULL) - free(it->inputs[i], M_TEMP, 0); + free(it->inputs[i], M_TEMP, 0); free(it->inputs, M_TEMP, 0); } it->inputs_size = 0; @@ -1874,8 +1873,7 @@ uaudio_identify_ac(struct uaudio_softc * continue; pot = iot[i].d.ot; tml = uaudio_io_terminaltype(UGETW(pot->wTerminalType), iot, i); - if (tml != NULL) - free(tml, M_TEMP, 0); + free(tml, M_TEMP, 0); } #ifdef UAUDIO_DEBUG @@ -1988,14 +1986,11 @@ uaudio_identify_ac(struct uaudio_softc * if (iot[i].d.desc == NULL) continue; if (iot[i].inputs != NULL) { - for (j = 0; j < iot[i].inputs_size; j++) { - if (iot[i].inputs[j] != NULL) - free(iot[i].inputs[j], M_TEMP, 0); - } + for (j = 0; j < iot[i].inputs_size; j++) + free(iot[i].inputs[j], M_TEMP, 0); free(iot[i].inputs, M_TEMP, 0); } - if (iot[i].output != NULL) - free(iot[i].output, M_TEMP, 0); + free(iot[i].output, M_TEMP, 0); iot[i].d.desc = NULL; } free(iot, M_TEMP, 256 * sizeof(struct io_terminal));