summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2015-03-04 12:56:27 +0100
committerJan Kara <jack@suse.cz>2015-03-04 12:56:27 +0100
commit61fab8271c677d89e644df1b3db98350f6271fcb (patch)
tree385bca09afbca8300e2df008d4dbee7d25628052
parent0ac78e0d85ebf02241c13a8517a6a4fd1a72c3b1 (diff)
warnquota: Fix some leaks in LDAP lookup code
Some of LDAP functions return dynamically allocated memory that the caller is responsible to free. So do this to avoid memory leaks. Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--warnquota.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/warnquota.c b/warnquota.c
index 795a90c..be4474f 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -431,11 +431,15 @@ static char *lookup_user(struct configparams *config, char *user)
return NULL;
}
to = sstrdup(bvals[0]->bv_val);
+ ldap_memfree(a);
+ ldap_value_free_len(bvals);
break;
- }
+ }
+ ldap_memfree(a);
}
- ber_bvecfree(bvals);
+ ber_free(ber, 0);
+
if (to == NULL) {
/*
* use just the name and default domain as we didn't find the