summaryrefslogtreecommitdiffstats
path: root/server/providers
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-09-11 11:18:45 -0400
committerSimo Sorce <ssorce@redhat.com>2009-09-11 16:22:42 -0400
commitc8f8196386b54ba2caa506a2ce9db87b6a326084 (patch)
tree0cf306dcea507d471ee81a2622e2595fe2af2ca3 /server/providers
parent927d3062d150e479e5167836fb2da4c46cd81985 (diff)
downloadsssd-c8f8196386b54ba2caa506a2ce9db87b6a326084.tar.gz
sssd-c8f8196386b54ba2caa506a2ce9db87b6a326084.tar.xz
sssd-c8f8196386b54ba2caa506a2ce9db87b6a326084.zip
Fix memory mishandling.
By attaching the reply to a subreq, we ended up freeing the operations list element before we used it to skip to the next one. Do not steal the context and let the unlocking code free the old reply, when it moves onto processing the next one. Got this one with valgrind.
Diffstat (limited to 'server/providers')
-rw-r--r--server/providers/ldap/sdap_async.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/server/providers/ldap/sdap_async.c b/server/providers/ldap/sdap_async.c
index 15985fffc..84e13b51a 100644
--- a/server/providers/ldap/sdap_async.c
+++ b/server/providers/ldap/sdap_async.c
@@ -300,8 +300,14 @@ static void sdap_unlock_next_reply(struct sdap_op *op)
{
struct timeval no_timeout = {0, 0};
struct tevent_timer *te;
+ struct sdap_msg *next_reply;
- op->list = op->list->next;
+ if (op->list) {
+ next_reply = op->list->next;
+ /* get rid of the previous reply, it has been processed already */
+ talloc_zfree(op->list);
+ op->list = next_reply;
+ }
/* if there are still replies to parse, queue a new operation */
if (op->list) {
@@ -1392,9 +1398,6 @@ static void sdap_get_users_done(struct sdap_op *op,
return;
}
tevent_req_set_callback(subreq, sdap_get_users_save_done, req);
- /* attach reply to subreq,
- * will not be needed anymore once subreq is done */
- talloc_steal(subreq, reply);
break;
@@ -1616,9 +1619,6 @@ static void sdap_get_groups_done(struct sdap_op *op,
return;
}
tevent_req_set_callback(subreq, sdap_get_groups_save_done, req);
- /* attach reply to subreq,
- * will not be needed anymore once subreq is done */
- talloc_steal(subreq, reply);
break;
@@ -1945,9 +1945,6 @@ static void sdap_get_initgr_done(struct sdap_op *op,
return;
}
tevent_req_set_callback(subreq, sdap_get_initgr_save_done, req);
- /* attach reply to subreq,
- * will not be needed anymore once subreq is done */
- talloc_steal(subreq, reply);
break;