Page MenuHomeFreeBSD

tzcode: Avoid memory leak if pthread_setspecific() fails.
ClosedPublic

Authored by des on Jan 13 2023, 3:24 PM.
Tags
None
Referenced Files
F96382820: D38036.diff
Tue, Sep 24, 6:55 PM
F96298330: D38036.diff
Tue, Sep 24, 10:26 AM
Unknown Object (File)
Mon, Sep 23, 6:58 PM
Unknown Object (File)
Mon, Sep 23, 1:29 AM
Unknown Object (File)
Mon, Sep 23, 12:13 AM
Unknown Object (File)
Sat, Sep 21, 8:48 PM
Unknown Object (File)
Sat, Sep 21, 2:07 PM
Unknown Object (File)
Fri, Sep 20, 4:35 AM
Subscribers

Details

Summary

Reported by: Coverity (CID 1018472, 1018474)
MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This looks fine, but I'd suggest a better commit message explaining the Coverity issues would be helpful

This revision is now accepted and ready to land.Jan 13 2023, 4:35 PM
In D38036#864270, @imp wrote:

This looks fine, but I'd suggest a better commit message explaining the Coverity issues would be helpful

What needs explaining? Coverity correctly flagged that the code doesn't check the outcome of the _pthread_setspecific() calls, so I added checks.

In D38036#864286, @des wrote:

What needs explaining? Coverity correctly flagged that the code doesn't check the outcome of the _pthread_setspecific() calls, so I added checks.

Agreed, checking for failure seems self-explanatory.

In D38036#864286, @des wrote:

What needs explaining? Coverity correctly flagged that the code doesn't check the outcome of the _pthread_setspecific() calls, so I added checks.

Agreed, checking for failure seems self-explanatory.

Check outcome and cleanup on failure then. Since it's more than just a check and return...

Again, just a suggestion to make it better...

des retitled this revision from tzcode: Check outcome of pthread_getspecific(). to tzcode: Avoid memory leak if pthread_getspecific() fails..Jan 14 2023, 4:40 PM
des retitled this revision from tzcode: Avoid memory leak if pthread_getspecific() fails. to tzcode: Avoid memory leak if pthread_setspecific() fails..