Fwd: [PATCH] Fix leaks introduced in fc5a589abad0e8285f7d95007ebda76536e8fa7d.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---------- Forwarded message ----------
From: Akira TAGOH <akira@xxxxxxxxx>
Date: Mon, Sep 9, 2013 at 8:00 PM
Subject: Re: [PATCH] Fix leaks introduced in
fc5a589abad0e8285f7d95007ebda76536e8fa7d.
To: Emanuele Giaquinta <emanuele.giaquinta@xxxxxxxxx>


Thanks for reporting. fixed that issue with a bit different way.

On Mon, Sep 9, 2013 at 1:46 AM, Emanuele Giaquinta
<emanuele.giaquinta@xxxxxxxxx> wrote:
> Hi,
>
> the patch fixes two leaks (of fontdata and hashstr) in
> FcFreeTypeQueryFace. I noticed the bug because fc-cache was using 1-2GB
> of RSS on my os x 10.8 system.
>
> Best regards,
>
> Emanuele Giaquinta
>
> ---
>  src/fcfreetype.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/src/fcfreetype.c b/src/fcfreetype.c
> index 02e85cb..e68fefd 100644
> --- a/src/fcfreetype.c
> +++ b/src/fcfreetype.c
> @@ -1108,6 +1108,7 @@ FcFreeTypeQueryFace (const FT_Face  face,
>      char           *fontdata = NULL;
>      FT_Error       err;
>      FT_ULong       len = 0, alen;
> +    FcBool         error = FcTrue;
>
>      pat = FcPatternCreate ();
>      if (!pat)
> @@ -1773,12 +1774,7 @@ bail3:
>      }
>  #endif
>
> -    /*
> -     * Drop our reference to the charset
> -     */
> -    FcCharSetDestroy (cs);
> -
> -    return pat;
> +    error = FcFalse;
>
>  bail2:
>      FcCharSetDestroy (cs);
> @@ -1787,6 +1783,8 @@ bail1:
>         free (hashstr);
>      if (fontdata)
>         free (fontdata);
> +    if (!error)
> +       return pat;
>      FcPatternDestroy (pat);
>  bail0:
>      return NULL;
> --
> 1.8.3.4



--
Akira TAGOH


-- 
Akira TAGOH
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig




[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux