Date: Mon, 4 Apr 2005 20:30:11 GMT From: Craig Rodrigues <rodrigc@crodrigues.org> To: freebsd-threads@FreeBSD.org Subject: Re: threads/79526: A memory leak in pthread_rwlock_init() Message-ID: <200504042030.j34KUBM0023433@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR threads/79526; it has been noted by GNATS. From: Craig Rodrigues <rodrigc@crodrigues.org> To: Kimmo Mustonen <tzimmo@rommon.com> Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: threads/79526: A memory leak in pthread_rwlock_init() Date: Mon, 4 Apr 2005 16:25:40 -0400 On Mon, Apr 04, 2005 at 03:36:02PM +0300, Kimmo Mustonen wrote: > Haven't looked at the sources, but probably easy to fix. > I suppose pthread_rwlock_destroy() just does not free all the > resources pthread_rwlock_init() allocates. Can you try this patch? prwlock was being allocated by malloc inside pthread_rwlock_init(), but never freed. --- lib/libpthread/thread/thr_rwlock.c.orig Mon Apr 4 16:22:16 2005 +++ lib/libpthread/thread/thr_rwlock.c Mon Apr 4 16:23:26 2005 @@ -131,6 +131,7 @@ prwlock->blocked_writers = 0; *rwlock = prwlock; + free(prwlock); } } } -- Craig Rodrigues rodrigc@crodrigues.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504042030.j34KUBM0023433>