From: ratchov Date: Fri, 27 Jul 2018 05:48:59 +0000 (+0000) Subject: No need to test if pointer is NULL to call free(9). From X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e722ebbca5cc4a7f00a7844e425c862479b0aaee;p=openbsd No need to test if pointer is NULL to call free(9). From Michael W. Bombardieri. Thanks! --- diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index a25f5387de9..12034a62294 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.129 2018/07/07 13:03:08 landry Exp $ */ +/* $OpenBSD: uaudio.c,v 1.130 2018/07/27 05:48:59 ratchov Exp $ */ /* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */ /* @@ -1353,8 +1353,7 @@ uaudio_io_terminaltype(int outtype, struct io_terminal *iot, int id) 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 *sc, const usb_config_descriptor_t *cdesc 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 *sc, const usb_config_descriptor_t *cdesc 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));