In r340044 an attempt to quiet coverity warning cid 1357336 was incorrectly implemented leading to a possible double free.
It is possible for both the conditional free, and the unconditional free added in r340044 to be done, fix that by initializing uopt to NULL, removing the conditional free, and only using the unconditional free at the end.
Brought to my attention by Patrick Mooney of Joyent/illumos