Skip to contentSkip to conversation

Resource leaks in Xen

BUG Ryan Cai 2 participants 3 messages Dec 22, 2021

lore
Share & tools
lore
#1 lore raw
Quoted 3 lines · Ryan Cai

I am writing you to report potential resource leak bugs. In the file /xen/tools/flask/utils/label-pci.c, the methods fopen and fclose may not matched when returning at Line 76, resulting in a resource leak. Looking forward to your feedback. Thank for checking.

Locations, https://github.com/xen-project/xen/blame/25849c8b16f2a5b7fcd0a823e80a5f1b590291f9/tools/flask/utils/label-pci.c#L63-L76

Thanks for looking closely, but I'm afraid I don't see where any resources get leaked here: "f" will get closed implicitly after returning from main(). It might be good practice to close files explicitly, but that's purely cosmetic here afaics. Feel free to contribute a patch.

Jan

author
#2 lore raw

I have send a patch. Thank you for your reply.

Best,
Yuandao

On 22/12/2021, 5:28 PM, "Jan Beulich" <[email protected]> wrote:

On 22.12.2021 09:05, Ryan Cai wrote:
> I am writing you to report potential resource leak bugs. In the file /xen/tools/flask/utils/label-pci.c, the methods fopen and fclose may not matched when returning at Line 76, resulting in a resource leak. Looking forward to your feedback. Thank for checking.
>
> Locations, https://github.com/xen-project/xen/blame/25849c8b16f2a5b7fcd0a823e80a5f1b590291f9/tools/flask/utils/label-pci.c#L63-L76

Thanks for looking closely, but I'm afraid I don't see where any resources get leaked here: "f" will get closed implicitly after returning from main(). It might be good practice to close files explicitly, but that's purely cosmetic here afaics. Feel free to contribute a patch.

Jan