[tz] [PROPOSED PATCH] Make the library thread-safe if THREAD_SAFE is defined.
Paul Eggert
eggert at cs.ucla.edu
Mon Aug 18 14:44:19 UTC 2014
walter harms wrote:
> maybe lclptr = calloc(sizeof *lclptr,1); ?
> that would remove the need for lclptr->leapcnt = 0; etc.
> any information leak via padding bytes would be closed also.
Sorry, I don't see the information leak here, as lclptr is static and
does not escape to calling code.
More generally, the current code always uses malloc to allocate objects
dynamically, and switching to calloc would be a pragmatics change that
should be done as a separate patch.
I'm not entirely sold on the idea of using calloc to avoid leaking
information from previous uses of the memory. If information leakage is
a concern, surely it's better to use a malloc wrapper that clears memory
rather than to manually inspect and modify every call to malloc.
More information about the tz
mailing list