From ff0d8b0879c81f4743f38637063c0e26194f3e00 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Mon, 24 Jul 2017 14:05:16 +0700 Subject: [PATCH] openldap: Fixed possible dereference of NULL pointer If `plugin_register_complex_read()` has failed, then `cldap_free` is called which set pointer to NULL. That pointer is accessed by `cldap_shutdown()` callback later. --- src/openldap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openldap.c b/src/openldap.c index b3fcb10f..227c8e11 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -535,7 +535,7 @@ static int cldap_init(void) /* {{{ */ static int cldap_shutdown(void) /* {{{ */ { for (size_t i = 0; i < databases_num; i++) - if (databases[i]->ld != NULL) + if (databases[i] != NULL && databases[i]->ld != NULL) ldap_unbind_ext_s(databases[i]->ld, NULL, NULL); sfree(databases); databases_num = 0; -- 2.11.0