[PATCH v2 21/25] [libx11] Fixed by zero'ing conv on allocation. Then close_converter works properly.

Alan Coopersmith alan.coopersmith at oracle.com
Tue Feb 1 00:22:43 PST 2011


On 01/31/11 04:02 AM, Erkki Seppälä wrote:
> From: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
> 
> Using uninitialized value "conv->state" in call to function "close_converter"
> 
> Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> ---
>  modules/lc/def/lcDefConv.c |    2 +-
>  modules/lc/gen/lcGenConv.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/lc/def/lcDefConv.c b/modules/lc/def/lcDefConv.c
> index 5860a79..12a4861 100644
> --- a/modules/lc/def/lcDefConv.c
> +++ b/modules/lc/def/lcDefConv.c
> @@ -577,7 +577,7 @@ create_conv(
>      XlcConv conv;
>      State state;
>  
> -    conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
> +    conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec));
>      if (conv == NULL)
>  	return (XlcConv) NULL;
>  
> diff --git a/modules/lc/gen/lcGenConv.c b/modules/lc/gen/lcGenConv.c
> index 074a8d7..baac73a 100644
> --- a/modules/lc/gen/lcGenConv.c
> +++ b/modules/lc/gen/lcGenConv.c
> @@ -2650,7 +2650,7 @@ create_conv(
>      XlcConv conv;
>      State state;
>  
> -    conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
> +    conv = (XlcConv) Xcalloc(1, sizeof(XlcConvRec));
>      if (conv == NULL)
>  	return (XlcConv) NULL;
>  

For the code,
Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

but again, log summary needs work.


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



More information about the xorg-devel mailing list