From: Pavel Rochnyack Date: Mon, 24 Jul 2017 07:05:16 +0000 (+0700) Subject: openldap: Fixed possible dereference of NULL pointer X-Git-Tag: collectd-5.8.0~110^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ff0d8b0879c81f4743f38637063c0e26194f3e00;p=collectd.git 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. --- 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;