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)
Sun, Oct 20, 2:25 AM
Unknown Object (File)
Sep 30 2024, 12:44 PM
Unknown Object (File)
Sep 29 2024, 9:05 PM
Unknown Object (File)
Sep 25 2024, 5:20 AM
Unknown Object (File)
Sep 24 2024, 6:55 PM
Unknown Object (File)
Sep 24 2024, 10:26 AM
Unknown Object (File)
Sep 23 2024, 6:58 PM
Unknown Object (File)
Sep 23 2024, 1:29 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..