Subject: Re: [htdig3-dev] Re: scandir build problem with solaris
From: Jim Cole (firstname.lastname@example.org)
Date: Sat Sep 16 2000 - 02:38:36 PDT
Don Sleffel's bits of Thu, 14 Sep 2000 translated to:
>exactly how to exercise it to test if it works. Also I'm not sure
>if it might cause a memory leak. There is a malloc in it that I
>don't know if it ever get's freed or not.
Won't swear to it, but I don't think it leaks. All of the memory allocated
in scandir should end up as part of namelist, which is returned to the
calling method. The calling method is responsible for freeing that memory
after it has extracted the information it needs.
However, I am not at all certain that the calling function is properly
cleaning up after itself. I believe the delete  namelist is only going
to free up the pointers, not the actual dirent struct's. Or maybe I am
just too tired ;) There is also a bit of ugliness in that scandir is
using malloc/realloc for allocation and the calling function is using
delete for deallocation.
To unsubscribe from the htdig3-dev mailing list, send a message to
You will receive a message to confirm this.
This archive was generated by hypermail 2b28 : Sat Sep 16 2000 - 02:41:00 PDT