Fix descriptors leak in case of nvlist_xunpack() failure.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
Declare i.

Reported by:	sbruno
Use better type for i.