pam_winbind: fix segfault in pam_sm_authenticate()
authorDavid Disseldorp <ddiss@suse.de>
Wed, 2 Nov 2011 17:39:03 +0000 (18:39 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Oct 2012 10:42:23 +0000 (11:42 +0100)
Ensure the potentially null winbind context is not dereferenced on
cleanup.

https://bugzilla.samba.org/show_bug.cgi?id=8564

nsswitch/pam_winbind.c

index fc7cdcaea717ac0bfe814ea1922cb45c5ae4f0e0..325710122396b0d5f2ace90563153716b195b52e 100644 (file)
@@ -2735,9 +2735,10 @@ out:
                _pam_free_data_info3(pamh);
        }
 
-       _PAM_LOG_FUNCTION_LEAVE("pam_sm_authenticate", ctx, retval);
-
-       TALLOC_FREE(ctx);
+       if (ctx != NULL) {
+               _PAM_LOG_FUNCTION_LEAVE("pam_sm_authenticate", ctx, retval);
+               TALLOC_FREE(ctx);
+       }
 
        return retval;
 }