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

Re: memory leak in getprotobyname()



Roman,

--On 12/02/03 09:59:46 -0500 Roman Fleysher wrote:

I am not an expert on the subject, but it looks as if getprotobyname()
allocates a structure and returns a pointer to it. Thus, each time you
call it, new structure is allocated and new pointer is returned. You can
check it with

if(getprotobyname("tcp") != getprotobyname("tcp"))
  printf("Each call allocates new structure
          (assuming these were not NULL's)\n");

my getprotobyname() always returns the same pointer (even with different parameters - it modifies the structure of course), but it still grows
memory on some machines...

-Sven



Reply to: