[PATCH 1/2] libX11: Fix potential memory leaks during font set loading.

Jamey Sharp jamey at minilop.net
Mon Nov 23 10:12:24 PST 2009


On Mon, Nov 23, 2009 at 11:43 AM, Kim Woelders <kim at woelders.dk> wrote:
> On Mon, 23 Nov 2009 03:03:01 +0100, Alan Coopersmith <Alan.Coopersmith at sun.com> wrote:
>> Kim Woelders wrote:
>>> -    char *pattern = NULL, *ptr = NULL;
>>> +    char *pattern, *ptr;
>>
>> Why remove the initialization to NULL?
>
> They are useless assignments.

I'm in favor of removing redundant initializers, because it's
documentation that the programmer believed no initializer was
necessary, and gives the compiler the opportunity to check whether
that belief was justified. The code had better be built with warnings
turned on for possibly uninitialized variables, though.

Jamey


More information about the xorg-devel mailing list