Fix a resource leak when using strdup(3) and also fix few style(9).

Reported by:	Coverity
CID:		1394929
MFC after:	1 week
Sponsored by:	iXsystems Inc.
This commit is contained in:
Marcelo Araujo 2018-08-16 06:38:01 +00:00
parent 3955e1c03a
commit ec89307fb1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337889

View File

@ -1746,6 +1746,8 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *opts)
optidx++;
}
free(uopt);
if (sc->nvstore.ctx == NULL || sc->nvstore.size == 0) {
fprintf(stderr, "backing store not specified\n");
return (-1);
@ -1756,9 +1758,7 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *opts)
sc->nvstore.sectsz = blockif_sectsz(sc->nvstore.ctx);
for (sc->nvstore.sectsz_bits = 9;
(1 << sc->nvstore.sectsz_bits) < sc->nvstore.sectsz;
sc->nvstore.sectsz_bits++)
;
sc->nvstore.sectsz_bits++);
if (sc->max_queues == 0) {
fprintf(stderr, "Invalid maxq option\n");