Page MenuHomeFreeBSD

Fix a memory leak introduced in r328426.
ClosedPublic

Authored by markj on Feb 15 2018, 9:37 PM.
Tags
None
Referenced Files
F93063054: D14390.diff
Fri, Sep 6, 9:41 PM
Unknown Object (File)
Thu, Sep 5, 1:30 AM
Unknown Object (File)
Sun, Aug 18, 12:58 PM
Unknown Object (File)
Wed, Aug 14, 4:00 PM
Unknown Object (File)
Aug 4 2024, 4:47 AM
Unknown Object (File)
Jul 29 2024, 4:22 PM
Unknown Object (File)
Jul 28 2024, 5:30 PM
Unknown Object (File)
Jul 9 2024, 11:43 PM
Subscribers

Details

Summary

ffs_sbget() may return a superblock buffer even if it fails. Moreover,
readfunc returns a dynamically allocated buffer, when we call it on
backup superblocks, we need to free the previously allocated buffer.
Also fix what I believe is a free() of an uninitialized pointer if the
ffs_sbget() call in ffs_mountfs() fails before "fs" is set.

Test Plan

pho reported finding the leak while testing gmirror, tracked it down
to the aforementioned revision, and tested an earlier version of this
diff.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15075
Build 15169: arc lint + arc unit

Event Timeline

markj added reviewers: mckusick, kib.
markj added a subscriber: pho.
kib added inline comments.
lib/libufs/sblock.c
153

if () is redundant.

sys/ufs/ffs/ffs_subr.c
217

Most likely, this if () is redundant.

sys/ufs/ffs/ffs_vfsops.c
1078

I think if() is redundant.

This revision is now accepted and ready to land.Feb 15 2018, 10:15 PM
  • Remove unneeded if statements.
This revision now requires review to proceed.Feb 15 2018, 10:49 PM

I ran tests on D14390.39361 for 7 hours. LGTM.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 16 2018, 3:41 PM
This revision was automatically updated to reflect the committed changes.