Merge pull request #1308 from mfournier/openldap-persistent-connection
[collectd.git] / src / openldap.c
index dc93334..615aee3 100644 (file)
 #include "plugin.h"
 #include "configfile.h"
 
+#if defined(__APPLE__)
+#pragma clang diagnostic push
+#pragma clang diagnostic warning "-Wdeprecated-declarations"
+#endif
+
 #include <lber.h>
 #include <ldap.h>
 
@@ -556,13 +561,12 @@ static int cldap_config_add (oconfig_item_t *ci) /* {{{ */
        int i;
        int status;
 
-       st = malloc (sizeof (*st));
+       st = calloc (1, sizeof (*st));
        if (st == NULL)
        {
-               ERROR ("openldap plugin: malloc failed.");
+               ERROR ("openldap plugin: calloc failed.");
                return (-1);
        }
-       memset (st, 0, sizeof (*st));
 
        status = cf_util_get_string (ci, &st->name);
        if (status != 0)
@@ -735,3 +739,7 @@ void module_register (void) /* {{{ */
        plugin_register_init ("openldap", cldap_init);
        plugin_register_shutdown ("openldap", cldap_shutdown);
 } /* }}} void module_register */
+
+#if defined(__APPLE__)
+#pragma clang diagnostic pop
+#endif