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 12:02:20 +0000 (13:02 +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 83d7bb67da9e6f9c23716fe1f1dbf7e269098096..29d6f7c7bc37de8c7bebfeccab0f8c54d90887d7 100644 (file)
@@ -2736,9 +2736,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;
 }