Blob Blame History Raw
From 54aa951a69cb0d0d4f2b154bff520145ecd659cf Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Wed, 6 Apr 2016 18:35:39 +0200
Subject: [PATCH 110/111] memberof: Fix a memory leak when removing ghost users
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
(cherry picked from commit c07fb3f111b4dc2780fa4e1408ea04cd36e95a4d)
---
 src/ldb_modules/memberof.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index be7c07dbcda257b6d813bb232ec27973167c25c4..118e95a4d3b6246f2c7775f300ac345ac63ff17a 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -2531,7 +2531,7 @@ static int mbof_del_fill_ghop_ex(struct mbof_del_ctx *del_ctx,
               num_gh_vals, mbof->num_values);
 
     for (i = 0; i < mbof->num_values; i++) {
-        valdn = ldb_dn_from_ldb_val(del_ctx->ghops,
+        valdn = ldb_dn_from_ldb_val(del_ctx,
                                     ldb_module_get_ctx(del_ctx->ctx->module),
                                     &mbof->values[i]);
         if (!valdn || !ldb_dn_validate(valdn)) {
@@ -2556,6 +2556,7 @@ static int mbof_del_fill_ghop_ex(struct mbof_del_ctx *del_ctx,
             if (ret != LDB_SUCCESS) {
                 return ret;
             }
+            talloc_steal(del_ctx->ghops, valdn);
         }
     }
 
-- 
2.4.11