Page MenuHomeFreeBSD

sesutil: plug memory leaks
ClosedPublic

Authored by asomers on Jan 19 2022, 9:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 11, 8:56 AM
Unknown Object (File)
Fri, Oct 10, 4:39 PM
Unknown Object (File)
Fri, Oct 10, 12:29 PM
Unknown Object (File)
Mon, Oct 6, 3:27 AM
Unknown Object (File)
Sep 14 2025, 4:55 AM
Unknown Object (File)
Sep 9 2025, 7:49 PM
Unknown Object (File)
Aug 18 2025, 1:49 PM
Unknown Object (File)
Aug 16 2025, 4:25 PM
Subscribers

Details

Summary

MFC after: 2 weeks
Sponsored by: Axcient

Test Plan

ran all sesutil commands with valgrind

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I have no objections, but have few comments.

usr.sbin/sesutil/sesutil.c
528

I usually prefer to free resources in order opposite to allocation.

It is also a bit weird to allocate/free memory on every loop iteration. I have some enclosures with about 300 elements.

639

As I see fetch_device_details() always initializes model and serial arguments, even in case of error, so this was not necessary. Though it is not wrong either. As you wish.

856

Same comment about every iteration.

This revision is now accepted and ready to land.Feb 17 2022, 4:41 AM
This revision was automatically updated to reflect the committed changes.

I sort of forgot about this review. I've committed it as-is, and next I'll make the memory allocations more efficient, as @mav suggested.