>It also seems to have a useless malloc that results in a memory leak:
>
> 103 +#elif defined(HAVE_GETPEERUCRED)
> 104 + if ((creds = (ucred_t *)malloc(ucred_size()))==(ucred_t
> *)NULL){
> 105 + GAM_DEBUG(DEBUG_INFO,"Malloc failed for ucreds");
> 106 + goto failed;
> 107 + }
> 108 +
> 109 + if (getpeerucred(fd, &creds)!=0){
> 110 + GAM_DEBUG(DEBUG_INFO,"getpeerucred call failed");
> 111 + goto failed;
> 112 + }
>
>getpeerucred allocates and returns the ucred structure - you don't need
>to preallocate it.
But if you pass it a pre-allocated one, then it will use that instead.
Casper