[PATCH v2 07/25] [libx11] Fixed memory leak by adding Xfree and initializing missing_list with NULL

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 31 23:19:02 PST 2011


On 01/31/11 04:01 AM, Erkki Seppälä wrote:
> Variable "missing_list" goes out of scope
> 
> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> ---
>  modules/im/ximcp/imRmAttr.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/modules/im/ximcp/imRmAttr.c b/modules/im/ximcp/imRmAttr.c
> index d62dfdb..ae053c9 100644
> --- a/modules/im/ximcp/imRmAttr.c
> +++ b/modules/im/ximcp/imRmAttr.c
> @@ -313,7 +313,7 @@ _XimAttributeToValue(
>  	    INT16	 len = data[0];
>  	    char	*base_name;
>  	    XFontSet	 rep = (XFontSet)NULL;
> -	    char	**missing_list;
> +	    char	**missing_list = NULL;
>  	    int		 missing_count;
>  	    char	*def_string;
>  
> @@ -347,6 +347,7 @@ _XimAttributeToValue(
>  	    }
>  
>  	    Xfree(base_name);
> +	    Xfree(missing_list);
>  	    *((XFontSet *)value) = rep;
>  	    break;
>  	}

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