Reviewed-by: Jeremy Huddleston <[email protected]>

On May 16, 2011, at 18:33, Alan Coopersmith wrote:

> Go ahead and fill in the font->info pointers so that bitmapUnloadScalable()
> will free the bits that were allocated, even if some were not.
> 
> Error: Memory leak (CWE 401)
>   Memory leak of pointer <unknown> allocated with ComputeScaledProperties(...)
>        at line 1629 of 
> /export/alanc/X.Org/git/lib/libXfont/src/bitmap/bitscale.c in function 
> 'BitmapOpenScalable'.
>          pointer allocated at line 1616 with ComputeScaledProperties(...).
>          <unknown> leaks when props != 0 at line 1623.
> 
> [ This bug was found by the Parfait 0.3.7 bug checking tool.
>  For more information see http://labs.oracle.com/projects/parfait/ ]
> 
> Signed-off-by: Alan Coopersmith <[email protected]>
> ---
> src/bitmap/bitscale.c |   11 ++++-------
> 1 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c
> index cf16bff..50818c6 100644
> --- a/src/bitmap/bitscale.c
> +++ b/src/bitmap/bitscale.c
> @@ -1620,19 +1620,16 @@ BitmapOpenScalable (FontPathElementPtr fpe,
>     if (!sourceFont->refcnt)
>       FontFileCloseFont((FontPathElementPtr) 0, sourceFont);
> 
> +    font->info.props = props;
> +    font->info.nprops = propCount;
> +    font->info.isStringProp = isStringProp;
> +
>     if (propCount && (!props || !isStringProp))
>     {
> -     font->info.nprops = 0;
> -     font->info.props = (FontPropPtr)0;
> -     font->info.isStringProp = (char *)0;
>       bitmapUnloadScalable(font);
>       return AllocError;
>     }
> 
> -    font->info.props = props;
> -    font->info.nprops = propCount;
> -    font->info.isStringProp = isStringProp;
> -
>     *pFont = font;
>     return Successful;
> }
> -- 
> 1.7.3.2
> 
> _______________________________________________
> [email protected]: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to