From 57ce6c99123854da69ce07fb8305d102b8e9d271 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jcholast@redhat.com>
Date: Wed, 5 Nov 2014 08:46:19 +0000
Subject: [PATCH] Fix memory leaks in ipa-extdom-extop
https://fedorahosted.org/freeipa/ticket/4651
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
---
.../ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
index df04347e3d36b33ca0a4ea2391f60d97b75a97bf..20fdd62b20f28f5384cf83b8be5819f721c6c3db 100644
--- a/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
+++ b/daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_common.c
@@ -340,7 +340,8 @@ static int pack_ber_user(enum response_types response_type,
ber = ber_alloc_t( LBER_USE_DER );
if (ber == NULL) {
- return LDAP_OPERATIONS_ERROR;
+ ret = LDAP_OPERATIONS_ERROR;
+ goto done;
}
ret = ber_printf(ber,"{e{ssii", response_type, domain_name, short_user_name,
@@ -449,14 +450,15 @@ static int pack_ber_group(enum response_types response_type,
ber = ber_alloc_t( LBER_USE_DER );
if (ber == NULL) {
- return LDAP_OPERATIONS_ERROR;
+ ret = LDAP_OPERATIONS_ERROR;
+ goto done;
}
ret = ber_printf(ber,"{e{ssi", response_type, domain_name, short_group_name,
gid);
if (ret == -1) {
- ber_free(ber, 1);
- return LDAP_OPERATIONS_ERROR;
+ ret = LDAP_OPERATIONS_ERROR;
+ goto done;
}
if (response_type == RESP_GROUP_MEMBERS) {
@@ -716,7 +718,7 @@ static int handle_sid_request(enum request_types request_type, const char *sid,
ret = get_buffer(&buf_len, &buf);
if (ret != LDAP_SUCCESS) {
- return ret;
+ goto done;
}
switch(id_type) {
--
2.1.0