[PATCH v2 06/25] [libx11] Fixed memory leak by adding Xfree

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


On 01/31/11 04:01 AM, Erkki Seppälä wrote:
> Variable "colormap_ret" 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 b6d1e12..d62dfdb 100644
> --- a/modules/im/ximcp/imRmAttr.c
> +++ b/modules/im/ximcp/imRmAttr.c
> @@ -999,7 +999,7 @@ _XimEncodeStatusValue(
>      XIMArg		*p)
>  {
>      if (res->xrm_name == XrmStringToQuark(XNStdColormap)) {
> -	XStandardColormap	*colormap_ret;
> +	XStandardColormap	*colormap_ret = NULL;
>  	int			 count;
>  
>  	if (!(XGetRGBColormaps(ic->core.im->core.display,
> @@ -1007,6 +1007,7 @@ _XimEncodeStatusValue(
>  				&count, (Atom)p->value)))
>  	    return False;
>  
> +	XFree(colormap_ret);
>      } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) {
>  	int		  list_ret;
>  	XFontStruct	**struct_list;

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