Page MenuHomeFreeBSD

savecore: fix memory leaks
AbandonedPublic

Authored by asomers on Jun 30 2020, 12:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 7:14 PM
Unknown Object (File)
Dec 20 2023, 4:12 AM
Unknown Object (File)
Jun 3 2023, 8:18 AM
Unknown Object (File)
May 22 2023, 6:26 PM
Unknown Object (File)
May 14 2023, 6:54 PM
Subscribers
None

Details

Reviewers
cem
imp
markj
Summary

savecore: fix memory leaks

Most of these memory leaks are long-standing, but r362790 added a few more.
Valgrind is unable to detect them due to Capsicum. I don't know why Coverity
never spotted them.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32052
Build 29577: arc lint + arc unit

Event Timeline

asomers created this revision.

All memory is freed at program exit.

I don't think the additional complexity buys us anything for small programs like this.

In D25515#563786, @cem wrote:

All memory is freed at program exit.

I don't think the additional complexity buys us anything for small programs like this.

I tend to agree. I would be more supportive if the change involved refactoring DoFile() a bit, since that function is quite sprawling.

sbin/savecore/savecore.c
987

You could avoid using a triple pointer by returning devs and making argc an output parameter, or by allocating devs in the caller.

Abandoning diff, since it was reviewed negatively.