Page MenuHomeFreeBSD

Don't leak fd on sectorsize malloc failure
ClosedPublic

Authored by ngie on Apr 20 2016, 12:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 22 2024, 10:12 PM
Unknown Object (File)
Mar 22 2024, 10:12 PM
Unknown Object (File)
Mar 22 2024, 10:12 PM
Unknown Object (File)
Mar 9 2024, 2:30 PM
Unknown Object (File)
Jan 6 2024, 11:47 AM
Unknown Object (File)
Jan 6 2024, 11:44 AM
Unknown Object (File)
Jan 6 2024, 11:44 AM
Unknown Object (File)
Jan 5 2024, 3:42 PM
Subscribers

Details

Reviewers
cem
Summary

Don't leak fd on sectorsize malloc failure

Also, call endfsent after calling getfsent for code cleanliness

CID: 1354785
X-MFC with: r298076
Reported by: Coverity
Sponsored by: EMC / Isilon Storage Division

Diff Detail

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

Event Timeline

ngie retitled this revision from to Don't leak fd on sectorsize malloc failure.
ngie updated this object.
ngie edited the test plan for this revision. (Show Details)
ngie added a reviewer: cem.
ngie added a subscriber: markj.
sbin/savecore/savecore.c
843โ€“848

If my reading of getfsent(3) is correct (endfsent() 1:1 with getfsent()), we should call endfsent() before continue in the !swap && !dump case as well.

Move endfsent call outside the loop

It should only be called once

ngie added inline comments.
sbin/savecore/savecore.c
843โ€“848

It should have been outside the for (;;) loop -- good catch!

In D6014#128089, @ngie wrote:

Move endfsent call outside the loop

It should only be called once

Are you sure about that? The man page is pretty unclear to me.

cem edited edge metadata.

Ok, you're right per the implementation.

This revision is now accepted and ready to land.Apr 20 2016, 12:46 AM
In D6014#128094, @cem wrote:
In D6014#128089, @ngie wrote:

Move endfsent call outside the loop

It should only be called once

Are you sure about that? The man page is pretty unclear to me.

Yeah... the cobwebs I dusted off had to deal with using the API back in my Linux days.. had to deal with perl IIRC *shudders*...