cvs commit: src/lib/libc/gen ttyname.c

Hajimu UMEMOTO ume at freebsd.org
Sat May 14 21:47:41 PDT 2005


Hi,

>>>>> On Sat, 14 May 2005 23:01:30 -0400
>>>>> Craig Rodrigues <rodrigc at crodrigues.org> said:

rodrigc> If you link code with -pthread (and __isthreaded=1), then
rodrigc> in ttyname() in /usr/src/lib/libc/gen/ttyname.c, there
rodrigc> is a malloc() called, but there is no corresponding free().
rodrigc> malloc() is never called if __isthreaded=0.

No, it seems that free() is registered to call when a thread is
finished:

			if (_pthread_key_create(&ttyname_key, free)) {
				_pthread_mutex_unlock(&ttyname_lock);
				return (NULL);
			}

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume at mahoroba.org  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/


More information about the cvs-all mailing list