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
F171306727: D38036.id115132.diff
Thu, Sep 10, 7:22 AM
F171305855: D38036.id115037.diff
Thu, Sep 10, 7:15 AM
F171305056: D38036.diff
Thu, Sep 10, 7:06 AM
Unknown Object (File)
Fri, Aug 28, 8:21 AM
Unknown Object (File)
Thu, Aug 27, 6:17 PM
Unknown Object (File)
Aug 9 2026, 3:13 AM
Unknown Object (File)
Aug 8 2026, 8:56 PM
Unknown Object (File)
Aug 8 2026, 4:08 PM
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..