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
Unknown Object (File)
Mar 10 2024, 6:46 PM
Unknown Object (File)
Mar 7 2024, 9:38 PM
Unknown Object (File)
Mar 7 2024, 9:38 PM
Unknown Object (File)
Mar 7 2024, 8:59 PM
Unknown Object (File)
Feb 4 2024, 4:23 PM
Unknown Object (File)
Jan 3 2024, 1:23 PM
Unknown Object (File)
Jan 3 2024, 1:10 PM
Unknown Object (File)
Dec 20 2023, 7:46 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..