Fix a leak for the subfont when using other fonts than the default. Notes: Thu May 26 08:01:02 EDT 2005 rsc have to think about this. you've correctly identified the cause of the leak, i just need to figure out whether this is the right fix. Sat May 28 08:01:49 EDT 2005 rsc I believe that there is a leak, but I do not believe that this change can possibly fix it. It may well stir things around to make it harder to find. Do you have a simple program that demonstrates the leak? Reference: /n/sources/patch/sorry/stringwidth2 Date: Thu May 26 13:36:13 CES 2005 Reviewed-by: rsc --- /sys/src/libdraw/string.c Thu May 26 13:36:04 2005 +++ /sys/src/libdraw/string.c Thu May 26 13:36:01 2005 @@ -65,6 +65,7 @@ char **sptr; Rune **rptr; Font *def; + Subfont* sf; if(s == nil){ s = ""; @@ -124,13 +125,14 @@ len -= n; } if(subfontname){ - if(_getsubfont(f->display, subfontname) == 0){ + if((sf=_getsubfont(f->display, subfontname)) == 0){ def = f->display->defaultfont; if(def && f!=def) f = def; else break; - } + } else + installsubfont(subfontname, sf); } } return pt;