Plan 9 from Bell Labs’s /usr/web/sources/extra/changes/2005/1103

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Close small font leak.
 [rsc] --rw-rw-r-- M 261901 glenda sys 3166 Nov  3 12:05 sys/src/libdraw/string.c
	/n/sourcesdump/2005/1103/plan9/sys/src/libdraw/string.c:65,70 - 
	/n/sourcesdump/2005/1104/plan9/sys/src/libdraw/string.c:65,71
	  	char **sptr;
	  	Rune **rptr;
	  	Font *def;
	+ 	Subfont *sf;
	  
	  	if(s == nil){
	  		s = "";
	/n/sourcesdump/2005/1103/plan9/sys/src/libdraw/string.c:76,81 - 
	/n/sourcesdump/2005/1104/plan9/sys/src/libdraw/string.c:77,83
	  		rptr = nil;
	  	}else
	  		rptr = &r;
	+ 	sf = nil;
	  	while((*s || *r) && len){
	  		max = Max;
	  		if(len < max)
	/n/sourcesdump/2005/1103/plan9/sys/src/libdraw/string.c:124,136 - 
	/n/sourcesdump/2005/1104/plan9/sys/src/libdraw/string.c:126,143
	  			len -= n;
	  		}
	  		if(subfontname){
	- 			if(_getsubfont(f->display, subfontname) == 0){
	- 				def = f->display->defaultfont;
	+ 			freesubfont(sf);
	+ 			if((sf=_getsubfont(f->display, subfontname)) == 0){
	+ 				def = f->display ? f->display->defaultfont : nil;
	  				if(def && f!=def)
	  					f = def;
	  				else
	  					break;
	  			}
	+ 			/* 
	+ 			 * must not free sf until cachechars has found it in the cache
	+ 			 * and picked up its own reference.
	+ 			 */
	  		}
	  	}
	  	return pt;


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.