the call to _getsubfont just puts the subfont into the subfont
cache so the character can be looked up there the next time
around the loop.  there should be no leak.  freeing the subfont
will break the cache.

-rob

On 5/26/05, Fco. J. Ballesteros <[EMAIL PROTECTED]> wrote:
> 
> Hi,
> 
>         I've seen that  at point
> sys/src/libdraw/stringwidth.c:46
>   45            if(subfontname){
> >46                     if(_getsubfont(f->display, subfontname) == 0){
>  47                             def = f->display->defaultfont;
>  48                             if(def && f!=def)
>  49                                     f = def;
>  50                             else
>  51                                     break;
> 
> there seems to be a leak.
> _getsubfont returns a Subfont, which is not freed. However, there
> seems to be some side effect, because if I free the subfont, the routine 
> breaks.
> 
> This came from using leak on a program using stringwidth a lot. The program
> shows leaks that come from this point. So I tried to fix it. I still don't 
> know enough
> of font handling to propose a course of action. Any suggestion?
> 
> If I come up with a fix, I'll send a patch anyway.
> 
> thanks
> 
>

Reply via email to