[Mesa-dev] [PATCH] Fix GET_PROGRAM_NAME() on Solaris to not try to modify a read-only string
alan.coopersmith at oracle.com
Fri Apr 8 13:45:03 PDT 2011
On 04/ 8/11 01:18 PM, Jakob Bornecrantz wrote:
> On Fri, Apr 8, 2011 at 10:12 PM, Jakob Bornecrantz <wallbraker at gmail.com> wrote:
>> On Fri, Apr 8, 2011 at 10:04 PM, Alan Coopersmith
>> <alan.coopersmith at oracle.com> wrote:
>>> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
>> Obvious question to this is was the string returned from
>> GET_PROGRAM_NAME freed in the past?
> Bah, read the code again while we only leak one string its still a
> leak and valgrind will complain (libraries that have these type of
> leaks is a pet peeve of mine). But making it not leak will be
> ridiculous, bah humbug. Other then that I see no problems with the
> patch, while you don't have my ACK/RB I'm not NACK:ing it either.
Will it? It's not truly leaked since it's stored in a static for re-use.
Unfortunately, GET_PROGRAM_NAME() does different things on different OS'es,
and the current model doesn't free it on any.
I suppose we could also define FREE_PROGRAM_NAME() and define it to do
nothing on OS'es where it returns a pointer to a static string from libc,
but that's a bit overkill for the handful of bytes in the average case.
(If your execname is more than 1k, you're doing it wrong.)
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the mesa-dev