[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#365233: libc6: memory leak in getprotobyname



On Fri, Apr 28, 2006 at 06:51:54PM +0200, Slaven Rezic wrote:

> #include <netdb.h>
> main() {
>     struct protoent *pent;
>     while(1) {
> 	pent = getprotobyname("tcp");
>     }
> }

valgrind shows that the leaking function is fopen(), called from
getprotobyname_r(). It seems that getprotobyname_r() does not check if
it already has /etc/protocols open and always opens a new file
descriptor for it.

Gabor

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------



Reply to: