[PATCH 3/5] parser: xf86readConfigFile: unreachable: This code cannot be reached: "free(val.str); "

Alan Coopersmith Alan.Coopersmith at Sun.COM
Mon Mar 15 15:03:14 PDT 2010


Are you sure you're not freeing the value that Error will be printing?

val.str is unfortunately a global, that seems to be set at least some times
to the same pointer that xf86tokenString() may return.

(Does it even matter if we free or not?   Does returning an error from
config file parsing ever not cause the server to exit?)

	-alan-

Oliver McFadden wrote:
> Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
> ---
>  hw/xfree86/parser/read.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
> index 1091be5..4e42b24 100644
> --- a/hw/xfree86/parser/read.c
> +++ b/hw/xfree86/parser/read.c
> @@ -219,15 +219,15 @@ xf86readConfigFile (void)
>  			}
>  			else
>  			{
> -				Error (INVALID_SECTION_MSG, xf86tokenString ());
>  				free(val.str);
>  				val.str = NULL;
> +				Error (INVALID_SECTION_MSG, xf86tokenString ());
>  			}
>  			break;
>  		default:
> -			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
>  			free(val.str);
>  			val.str = NULL;
> +			Error (INVALID_KEYWORD_MSG, xf86tokenString ());
>  		}
>  	}
>  

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



More information about the xorg-devel mailing list