Page MenuHomeFreeBSD

bhyve: avoid resource leak in error path
ClosedPublic

Authored by khorben_defora.org on May 16 2024, 5:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Aug 1, 5:46 PM
Unknown Object (File)
Wed, Jul 31, 9:32 PM
Unknown Object (File)
Tue, Jul 30, 1:07 PM
Unknown Object (File)
Mon, Jul 29, 3:06 AM
Unknown Object (File)
Sat, Jul 20, 11:11 PM
Unknown Object (File)
Thu, Jul 18, 7:36 AM
Unknown Object (File)
Fri, Jul 12, 9:14 PM
Unknown Object (File)
Tue, Jul 9, 4:56 AM
Subscribers

Details

Summary

In e820_finalize(), the e820_fwcfg_item variable, containing the etc/e820 file (for the e820 table from the BIOS) is not free()'d when it could not be added to the QEMU firmware configuration device (fw_cfg).

Test Plan

Source code review.

The only user of this function I could find is bhyve_init_platform_late(), which is called by main() in bhyverun.c, which exits upon errors. (4 "exited due to an error")

Therefore, as things are this fix looks superfluous, but it would quiet Coverity down for this code path.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

khorben_defora.org edited the test plan for this revision. (Show Details)
jhb added a reviewer: corvink.
This revision is now accepted and ready to land.May 16 2024, 5:35 PM
This revision was automatically updated to reflect the committed changes.
usr.sbin/bhyve/amd64/e820.c
490

what happens with e820_fwcfg_item->data in this case?

usr.sbin/bhyve/amd64/e820.c
490

The ownership was handed off to qemu_fwcfg_add_file