Version: OpenSSH 6.7p1 Platform: ARM and x86_64 (both using offical ArchLinux packages) I am writing a PAM module for OpenSSH where I register a cleanup function as follows: int rc = pam_set_data(pamh, "x509_info", x509_info, &cleanup_x509_info); The cleanup function so far is only there for testing purposes: static void cleanup_x509_info(pam_handle_t *pamh, void *data, int error_status) { FILE *foo = fopen("/tmp/THIS_IS_A_TEST", "a"); close(foo); LOG_MSG("Cleanup called"); } Whether the file nor the log entry is there. So I suppose the function will never be called. This is not optimal as datastructures should be freed here currently leading to memory leaks. The sshd_config can be find attached. Sebastian