HomeFreeBSD

bhyve: Fix resource leak when using strdup

Description

bhyve: Fix resource leak when using strdup

MFC r340044 (araujo):

Fix resource leak when using strdup(3).

MFC r344160 (rgrimes):

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.

CID: 1357336
Reported by: Coverity

Details

Provenance
emasteAuthored on
Parents
rS350251: bhyve: Fix resource leak when using strdup
Branches
Unknown
Tags
Unknown