[PATCH v2 16/25] [libx11] property_return was not free'd if the allocation of pRedTbl failed.

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 31 23:58:13 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>
> 
> xcms/LRGB: Fix potential resource leak.
> 
> 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>
> ---
>  src/xcms/LRGB.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/xcms/LRGB.c b/src/xcms/LRGB.c
> index d9168bd..c1606be 100644
> --- a/src/xcms/LRGB.c
> +++ b/src/xcms/LRGB.c
> @@ -686,6 +686,7 @@ LINEAR_RGB_InitSCCData(
>  	    /* Red Intensity Table */
>  	    if (!(pScreenData->pRedTbl = (IntensityTbl *)
>  		    Xcalloc (1, sizeof(IntensityTbl)))) {
> +		XFree ((char * ) property_return);
>  		goto FreeSCCData;
>  	    }
>  	    if (_XcmsGetTableType0(pScreenData->pRedTbl, format_return, &pChar,
> @@ -723,6 +724,7 @@ LINEAR_RGB_InitSCCData(
>  	    /* Red Intensity Table */
>  	    if (!(pScreenData->pRedTbl = (IntensityTbl *)
>  		    Xcalloc (1, sizeof(IntensityTbl)))) {
> +		XFree ((char * ) property_return);
>  		goto FreeSCCData;
>  	    }
>  	    if (_XcmsGetTableType1(pScreenData->pRedTbl, format_return, &pChar,

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