Page MenuHomeFreeBSD

Fix a memory leak in libutil
ClosedPublic

Authored by trix_juniper.net on Mar 2 2017, 3:19 PM.
Tags
None
Referenced Files
F137452566: D9867.diff
Sun, Nov 23, 2:53 PM
Unknown Object (File)
Sat, Nov 22, 4:50 PM
Unknown Object (File)
Wed, Nov 19, 3:05 AM
Unknown Object (File)
Thu, Oct 30, 3:11 AM
Unknown Object (File)
Sun, Oct 26, 12:47 PM
Unknown Object (File)
Sat, Oct 25, 1:36 PM
Unknown Object (File)
Oct 24 2025, 11:24 AM
Unknown Object (File)
Oct 23 2025, 1:13 AM
Subscribers

Details

Summary

kinfo_getvmobject.c kinfo_getvmobject
When sysctlbyname fails, free buf before returning.

Test Plan

Use clang's static analyzer, scan-build, to find the problem and show resolution.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

trix_juniper.net retitled this revision from to Fix a memory leak in libutil.
trix_juniper.net updated this object.
trix_juniper.net edited the test plan for this revision. (Show Details)
trix_juniper.net added reviewers: stevek, jhb.
trix_juniper.net set the repository for this revision to rS FreeBSD src repository - subversion.
jhb edited edge metadata.

Hmm, I was going to suggest looking in other places in libutil that I copied this from, but it seems other kinfo_getfoo() functions don't use a loop to retry but just add a fudge factor to the size and hope it is enough.

This revision is now accepted and ready to land.Mar 2 2017, 5:13 PM
This revision was automatically updated to reflect the committed changes.