diff options
author | Petr Písař <ppisar@redhat.com> | 2019-11-05 12:11:14 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-11-05 16:11:15 +0100 |
commit | 603bd8e61c299fdc66776f4f4a76d5397981a76c (patch) | |
tree | e90941d907aeef9801685ca87bdf360fc1f41da0 | |
parent | 688f9ac8896f7a60f11163832fc9a49d83d2a428 (diff) | |
download | linuxquota-603bd8e61c299fdc66776f4f4a76d5397981a76c.tar.gz |
warnquota: Free LDAP error message
ldap_get_option(3) documents that a pointer set by
LDAP_OPT_DIAGNOSTIC_MESSAGE must be freed with ldap_memfree(3).
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | warnquota.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/warnquota.c b/warnquota.c index d54b4c1..f6b42d5 100644 --- a/warnquota.c +++ b/warnquota.c @@ -190,8 +190,11 @@ static void print_ldap_error(int err, char *prefix) sstrncat(outbuf, ": %s\n", LDAP_ERR_BUF_SIZE); errstr(outbuf, ldap_err2string(err)); ldap_get_option(ldapconn, LDAP_OPT_DIAGNOSTIC_MESSAGE, (void *)&msg); - if (msg && strcmp(msg, "")) + if (msg) { + if (strcmp(msg, "")) errstr(_("Additional error info: %s\n"), msg); + ldap_memfree(msg); + } } static int setup_ldap(struct configparams *config) |