Page MenuHomeFreeBSD

savecore: fix memory leaks
Needs ReviewPublic

Authored by asomers on Tue, Jun 30, 12:15 AM.

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
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 32052
Build 29577: arc lint + arc unit

Event Timeline

asomers requested review of this revision.Tue, Jun 30, 12:15 AM
asomers created this revision.
cem added a comment.Tue, Jun 30, 1:53 AM

All memory is freed at program exit.

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

markj added a comment.Tue, Jun 30, 2:22 PM
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.