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, Feb 15, 8:07 PM
Unknown Object (File)
Sat, Jan 25, 12:05 AM
Unknown Object (File)
Jan 17 2025, 5:39 PM
Unknown Object (File)
Nov 20 2024, 9:00 AM
Unknown Object (File)
Oct 3 2024, 7:49 AM
Unknown Object (File)
Sep 24 2024, 7:57 PM
Unknown Object (File)
Sep 24 2024, 4:15 AM
Unknown Object (File)
Sep 22 2024, 2:17 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.