Page MenuHomeFreeBSD

bhyve: avoid resource leak in error path
ClosedPublic

Authored by khorben_defora.org on Thu, May 16, 5:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 22, 4:23 AM
Unknown Object (File)
Sun, May 19, 9:05 PM
Unknown Object (File)
Sun, May 19, 9:10 AM
Unknown Object (File)
Sun, May 19, 9:10 AM
Unknown Object (File)
Sun, May 19, 2:14 AM
Unknown Object (File)
Fri, May 17, 4:40 PM
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.Thu, May 16, 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