aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2023-08-05 17:44:29 +0200
committerChristian Göttsche <cgzones@googlemail.com>2023-08-07 12:26:41 +0200
commit4e8af9027dab25ebff3fa1b6e5542640611778c9 (patch)
tree9df4c3edfe7e04d709de550bbd4c4cdb51291355
parentcee08b7a6ea5d48f8527e3497735466e44445b66 (diff)
downloadpam-4e8af9027dab25ebff3fa1b6e5542640611778c9.tar.gz
pam-4e8af9027dab25ebff3fa1b6e5542640611778c9.tar.bz2
pam-4e8af9027dab25ebff3fa1b6e5542640611778c9.zip
pam_start: free handlers on handler init failure
If the pam handlers fail to initialize halfway, clean them up afterwards. Since we set the handle to NULL callers can't clean them.
-rw-r--r--libpam/pam_start.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libpam/pam_start.c b/libpam/pam_start.c
index 99dd0389..1fc36b3e 100644
--- a/libpam/pam_start.c
+++ b/libpam/pam_start.c
@@ -143,6 +143,7 @@ static int _pam_start_internal (
if ( _pam_init_handlers(*pamh) != PAM_SUCCESS ) {
pam_syslog(*pamh, LOG_ERR, "pam_start: failed to initialize handlers");
+ _pam_free_handlers(*pamh);
_pam_drop_env(*pamh); /* purge the environment */
_pam_drop((*pamh)->pam_conversation);
_pam_drop((*pamh)->service_name);