Page MenuHomeFreeBSD

Address memory leaks in the libc posix1e code found by Coverity.
ClosedPublic

Authored by pfg on Mar 7 2015, 3:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 1:15 PM
Unknown Object (File)
Dec 19 2023, 4:07 AM
Unknown Object (File)
Oct 29 2023, 11:50 PM
Unknown Object (File)
Oct 19 2023, 12:37 PM
Unknown Object (File)
Oct 13 2023, 8:01 PM
Unknown Object (File)
Oct 13 2023, 4:59 PM
Unknown Object (File)
Oct 13 2023, 2:57 PM
Unknown Object (File)
Sep 4 2023, 11:50 PM
Subscribers

Details

Summary

These look like memory leaks but I would like confirmation:
CID 1016705
CID 1016706
CID 1016707

Test Plan

Anything with ACLs

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

pfg retitled this revision from to Address memory leaks in the libc posix1e code found by Coverity..
pfg updated this object.
pfg edited the test plan for this revision. (Show Details)
pfg added reviewers: delphij, rwatson, trasz.
lib/libc/posix1e/acl_calc_mask.c
107 ↗(On Diff #4136)

Shouldn't this be acl_free(acl_new) instead?

126 ↗(On Diff #4136)

I know it's not in the patch, but it... looks curious. WTF?

lib/libc/posix1e/acl_strip.c
99 ↗(On Diff #4136)

You should also free acl_old, right? Same in the next few cases.

116 ↗(On Diff #4136)

... and here, and few below. Might be a good idea to replace all those "return (NULL)" with "goto fail" to avoid code duplication.

It is quite a mess, I was following blindly what Coverity reported.
I'll update the patch. thanks!

lib/libc/posix1e/acl_calc_mask.c
107 ↗(On Diff #4136)

Yes, I got confused by Coverity as it reports acl_int_new is (also) leaked.

126 ↗(On Diff #4136)

There's nothing here in "svn diff".

lib/libc/posix1e/acl_strip.c
86 ↗(On Diff #4136)

Coverity flags this one because acl_old != NULL from line 78.
It looks like Coverity doesn't know about acl_init().

99 ↗(On Diff #4136)

CID 1016705: From line 78 acl_new != NULL.
Coverity doesn't know about acl_get_entry().

This comment was removed by pfg.
This comment was removed by pfg.

It is much cleaner with the "fail" label.
(sorry for the spam)

pfg updated this revision to Diff 4214.

Closed by commit rS279962 (authored by @pfg).