Be protective and check the po_file validity before dropping the ref.

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
X-Differential revision:	https://reviews.freebsd.org/D12882
This commit is contained in:
kib 2017-11-01 11:37:45 +00:00
parent 1ae9155255
commit b7057b25e3

View File

@ -681,8 +681,11 @@ pmclog_deconfigure_log(struct pmc_owner *po)
}
/* drop a reference to the fd */
error = fdrop(po->po_file, curthread);
po->po_file = NULL;
if (po->po_file != NULL) {
error = fdrop(po->po_file, curthread);
po->po_file = NULL;
} else
error = 0;
po->po_error = 0;
return (error);