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)
Mon, Nov 11, 2:33 AM
Unknown Object (File)
Fri, Nov 8, 1:59 AM
Unknown Object (File)
Thu, Nov 7, 6:37 PM
Unknown Object (File)
Thu, Nov 7, 7:42 AM
Unknown Object (File)
Wed, Nov 6, 10:53 PM
Unknown Object (File)
Wed, Nov 6, 4:15 PM
Unknown Object (File)
Tue, Nov 5, 5:20 PM
Unknown Object (File)
Tue, Nov 5, 9:44 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 Not Applicable
Unit
Tests Not Applicable

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