Leak in XKeysymToString
Alan Coopersmith
alan.coopersmith at oracle.com
Mon Aug 22 18:37:51 UTC 2022
On 8/21/22 18:20, Po Lu wrote:
> Alan Coopersmith <alan.coopersmith at oracle.com> writes:
>
>> Okay, but we also document that Xlib is thread safe if XInitThreads() has
>> been called, so both the patch suggested here to keep a static pointer to
>> a malloc'ed buffer and my suggestion of a global static buffer fail since
>> calls in different threads would have a race condition over whose answer
>> got returned. We'd at least need a thread-specific buffer, which it
>> doesn't look like we've done in Xlib so far.
>
> In modern C that is as simple as using _Thread_local, I think.
I don't know if all our supported platforms support C11 yet - most will,
but even getting to full C99 support took years with holdouts from certain
NetBSD & OpenBSD platforms, and Microsoft's compilers.
(This is a code base that predates C89 by 5 years and was originally
written to K&R C, so C99 is pretty modern for us.)
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - https://blogs.oracle.com/solaris
More information about the xorg-devel
mailing list