[PATCH v2 3/3] [libx11] Cannot reach dead statement "return NULL; "

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 31 13:01:34 PST 2011


On 01/31/11 02:03 AM, Erkki Seppälä wrote:
> Check for the NULLness of prop->name and prop->value instead of
> name and value, which was checked earlier anyway. Decided against
> using strdup due to curious memory allocation functions and the
> rest of the xkb not using it either.
> 
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> 
> diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c
> index 17d13be..90ec2f9 100644
> --- a/src/xkb/XKBGAlloc.c
> +++ b/src/xkb/XKBGAlloc.c
> @@ -696,11 +696,11 @@ register XkbPropertyPtr prop;
>      }
>      prop= &geom->properties[geom->num_properties];
>      prop->name= (char *)_XkbAlloc(strlen(name)+1);
> -    if (!name)
> +    if (!prop->name)
>  	return NULL;
>      strcpy(prop->name,name);
>      prop->value= (char *)_XkbAlloc(strlen(value)+1);
> -    if (!value) {
> +    if (!prop->value) {
>  	_XkbFree(prop->name);
>  	prop->name= NULL;
>  	return NULL;

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list