pam_getenvlist returns a pointer to the complete PAM environment. This pointer points to an array of pointers to NUL-terminated strings and must be terminated by a NULL pointer. Each string has the form "name=value".
The PAM library module allocates memory for the returned value and the associated strings. The calling application is responsible for freeing this memory.