Blame SOURCES/0003-providers-proxy-fixed-usage-of-wrong-mem-ctx.patch

836b22
From 34412b2d90f324b178166af3ac852b4581f8493a Mon Sep 17 00:00:00 2001
836b22
From: Alexey Tikhonov <atikhono@redhat.com>
836b22
Date: Mon, 28 Jan 2019 18:47:27 +0100
836b22
Subject: [PATCH 3/9] providers/proxy: fixed usage of wrong mem ctx
836b22
MIME-Version: 1.0
836b22
Content-Type: text/plain; charset=UTF-8
836b22
Content-Transfer-Encoding: 8bit
836b22
836b22
Temporary var `grp` in proxy_id.c:remove_duplicate_group_members()
836b22
should be created in `tmp_ctx`.
836b22
Call to
836b22
```
836b22
*_grp = talloc_steal(mem_ctx, grp);
836b22
```
836b22
as well confirms it was original intent
836b22
(before fix this call didn't have any sense).
836b22
836b22
Having `grp` created in `mem_ctx` may lead to memory leak in case
836b22
of failure. While actually this doesn't happen since caller of
836b22
remove_duplicate_group_members() cleans mem_ctx, still it is
836b22
good to fix it.
836b22
836b22
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
836b22
(cherry picked from commit cc9f0f419b4c6bcd7f1a4d9f6ed45c89a33de9dc)
836b22
836b22
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
836b22
---
836b22
 src/providers/proxy/proxy_id.c | 2 +-
836b22
 1 file changed, 1 insertion(+), 1 deletion(-)
836b22
836b22
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
836b22
index db65a984c..52f7a6424 100644
836b22
--- a/src/providers/proxy/proxy_id.c
836b22
+++ b/src/providers/proxy/proxy_id.c
836b22
@@ -649,7 +649,7 @@ static errno_t remove_duplicate_group_members(TALLOC_CTX *mem_ctx,
836b22
         goto done;
836b22
     }
836b22
 
836b22
-    grp = talloc(mem_ctx, struct group);
836b22
+    grp = talloc(tmp_ctx, struct group);
836b22
     if (grp == NULL) {
836b22
         DEBUG(SSSDBG_OP_FAILURE, "talloc failed.\n");
836b22
         ret = ENOMEM;
836b22
-- 
836b22
2.21.1
836b22