Page MenuHomeFreeBSD

Plug Memory leak in libc's disklabel
ClosedPublic

Authored by pfg on Feb 4 2015, 3:49 PM.
Tags
None
Referenced Files
F145625079: D1775.id3632.diff
Sun, Feb 22, 8:26 AM
Unknown Object (File)
Wed, Feb 18, 10:44 PM
Unknown Object (File)
Jan 16 2026, 2:20 PM
Unknown Object (File)
Jan 16 2026, 3:27 AM
Unknown Object (File)
Jan 5 2026, 8:38 PM
Unknown Object (File)
Nov 21 2025, 4:05 AM
Unknown Object (File)
Nov 21 2025, 4:04 AM
Unknown Object (File)
Nov 21 2025, 4:04 AM
Subscribers

Details

Reviewers
jilles
imp
Summary

Resource leak (RESOURCE_LEAK)71. leaked_storage:
Variable cq going out of scope leaks the storage it points to.

CID: 270511
Obtained from: NetBSD (CVS rev. 1.34)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

pfg retitled this revision from to Plug Memory leak in libc's disklabel.
pfg updated this object.
pfg edited the test plan for this revision. (Show Details)
pfg added a reviewer: jilles.
pfg removed a reviewer: imp.

This was mostly taken from NetBSD.
I wonder why they changed > to >=in line 148.

I added the cgetclose(); at the end: it seemed appropriate.

imp added a reviewer: imp.
imp added a subscriber: imp.

Looks good to me. Do we have other users of cgetstr in the tree with the same leak?

This revision is now accepted and ready to land.Feb 4 2015, 4:03 PM

Thank you for the review.

Yes, it's not a common call but I see another leak at:
login_getcapstr() in lib/libutil/login_cap.c

I am traversing the list of old-standing coverity issues and I am focusing on libc first though.