[PATCH] xkb: when copying the keymap, make sure the structs default to 0/NULL.

Eric Piel E.A.B.Piel at tudelft.nl
Thu Feb 7 01:54:22 PST 2008


Rene van Paassen wrote:
> On 07/02/2008, Daniel Stone <daniel at fooishbar.org> wrote:
:
>> for consistency.
>>
>>>               if (dst->geom->sz_key_aliases && dst->geom->key_aliases) {
>>>                   xfree(dst->geom->key_aliases);
>>> -                dst->geom->key_aliases = NULL;
>>>               }
> 
> are the xfree semantics different from the malloc/free semantics? free
> should not trip over a NULL pointer. So we should NOT test for
> dst->geom->key_aliases (etc.) to be non-NULL before freeing these
> pointers.
> 
> free(NULL); is perfectly valid.
A priori, that should be obvious, but "man XFree" and you get a scary 
info ;-)
[..]  A NULL pointer cannot be passed to this function. [..]

I gues the semantic of xfree() is the same...
See you
Eric



More information about the xorg mailing list