#114:
There is no real issue in that code at this moment but it's only a lucky 
coincidence. If there was another element in group_attrs before member, the 
result would be SIGABRT.

#115:
Not really a memleak because of the memory hierarchy but I think it's nice to 
clean up memory when rewriting a pointer.

Thanks
Jan
From 311318de313e75703ad06b3ad78e76d1e80f6c72 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Tue, 17 Apr 2012 08:59:09 -0400
Subject: [PATCH 1/2] Fixed memory context in sdap_fill_memberships()

---
 src/providers/ldap/sdap_async_groups.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index b19e2b67005ecae4464ae10a7d75da5fa6e2b77b..fe116b96ae9741973d8a0de1c5fc29b10f54c7cb 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -108,7 +108,7 @@ static int sdap_fill_memberships(struct sysdb_attrs *group_attrs,
     }
 
     /* Just allocate both big enough to contain all members for now */
-    el->values = talloc_realloc(el, el->values, struct ldb_val,
+    el->values = talloc_realloc(group_attrs, el->values, struct ldb_val,
                                 el->num_values + num_values);
     if (!el->values) {
         ret = ENOMEM;
-- 
1.7.6.5

From 66d13dca9a725527d58f265e0e6821195e3dc329 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Tue, 17 Apr 2012 09:02:55 -0400
Subject: [PATCH 2/2] Fixed minor memory leak in ldap provider

---
 src/providers/ldap/sdap_async_groups.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index fe116b96ae9741973d8a0de1c5fc29b10f54c7cb..c7e4ac2794947f2ca040c644ab94f2ce835026c6 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -970,6 +970,7 @@ sdap_process_group_members_2307(struct sdap_process_group_state *state,
     }
 
     ret = EOK;
+    talloc_free(memberel->values);
     memberel->values = talloc_steal(state->group, state->sysdb_dns->values);
     memberel->num_values = state->sysdb_dns->num_values;
 
-- 
1.7.6.5

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to