[Fontconfig] fontconfig: Branch 'master'

Alan Coopersmith alan.coopersmith at oracle.com
Wed May 30 08:19:53 PDT 2012


(Don't you hate when you spot the mistakes in your e-mail as soon as it
 arrives back in your inbox?   I did mention not testing either suggestion,
 right?)

On 05/30/12 07:59 AM, Alan Coopersmith wrote:
> +        if (total_len > flen) {
> +            char *new_f = realloc(f, total_len);
> +            if (!new_f)
> +            {
> +                free(f);

Actually, since we continue looping, probably don't want to free(f),
so that we can just use it the next time through - if you do free it,
then f needs to be set to NULL to avoid double free, and flen needs
to be reset to 0 so we start the allocation anew on the next loop.

> +                ret = -1;
> +                goto bail;
> +            }
> +            f = new_f;

There should of course also be:
		flen = total_len;
here.

> +        }



-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the Fontconfig mailing list