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)
Mon, Nov 25, 12:10 AM
Unknown Object (File)
Sun, Nov 24, 12:39 PM
Unknown Object (File)
Fri, Nov 22, 2:15 PM
Unknown Object (File)
Thu, Nov 21, 1:29 AM
Unknown Object (File)
Wed, Nov 20, 1:45 PM
Unknown Object (File)
Sun, Nov 10, 4:12 PM
Unknown Object (File)
Fri, Nov 8, 6:50 AM
Unknown Object (File)
Fri, Nov 8, 2:25 AM
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
No Lint Coverage
Unit
No Test Coverage

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

Shouldn't this be acl_free(acl_new) instead?

126

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

lib/libc/posix1e/acl_strip.c
99

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

110

... 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

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

126

There's nothing here in "svn diff".

lib/libc/posix1e/acl_strip.c
86

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

99

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).