[PATCH 12/15] xkb: Fix allocation check to compare correct variable

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 27 16:20:47 PDT 2010


On Tue, Jul 27, 2010 at 03:09:53PM +0300, Pauli Nieminen wrote:
> prop->name is allocated in code but check is for parameter name that
> can't be NULL.
> 
> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> ---
>  xkb/XKBGAlloc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
> index d1adea3..7143e7a 100644
> --- a/xkb/XKBGAlloc.c
> +++ b/xkb/XKBGAlloc.c
> @@ -669,7 +669,7 @@ register XkbPropertyPtr prop;
>      }
>      prop= &geom->properties[geom->num_properties];
>      prop->name= malloc(strlen(name)+1);
> -    if (!name)
> +    if (!prop->name)
>  	return NULL;
>      strcpy(prop->name,name);
>      prop->value= malloc(strlen(value)+1);
> -- 
> 1.6.3.3

use strdup() instead?
both for prop->name and prop->value.

Cheers,
  Peter


More information about the xorg-devel mailing list