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
F98952497: D45223.id138661.diff
Sat, Oct 5, 11:33 AM
F98834735: D45223.id138661.diff
Fri, Oct 4, 10:19 PM
F98792099: D45223.diff
Fri, Oct 4, 6:59 PM
Unknown Object (File)
Fri, Oct 4, 2:29 AM
Unknown Object (File)
Wed, Oct 2, 5:36 PM
Unknown Object (File)
Wed, Oct 2, 4:46 PM
Unknown Object (File)
Wed, Oct 2, 3:34 PM
Unknown Object (File)
Wed, Oct 2, 4:15 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