e0e1b7
From 186ebe311bc9545d7a9860cd5e8c748131bbe41e Mon Sep 17 00:00:00 2001
e0e1b7
From: Francisco Trivino <ftrivino@redhat.com>
e0e1b7
Date: Thu, 10 Feb 2022 14:23:12 +0100
e0e1b7
Subject: [PATCH] ipa_cldap: fix memory leak
e0e1b7
e0e1b7
ipa_cldap_encode_netlogon() allocates memory to store binary data as part of
e0e1b7
berval (bv_val) when processing a CLDAP packet request from a worker. The
e0e1b7
data is used by ipa_cldap_respond() but bv_val is not freed later on.
e0e1b7
e0e1b7
This commit is adding the corresponding free() after ipa_cldap_respond()
e0e1b7
is completed.
e0e1b7
e0e1b7
Discovered by LeakSanitizer
e0e1b7
e0e1b7
Fixes: https://pagure.io/freeipa/issue/9110
e0e1b7
Signed-off-by: Francisco Trivino <ftrivino@redhat.com>
e0e1b7
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
e0e1b7
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
e0e1b7
Reviewed-By: Thierry Bordaz <tbordaz@redhat.com>
e0e1b7
---
e0e1b7
 daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c | 1 +
e0e1b7
 1 file changed, 1 insertion(+)
e0e1b7
e0e1b7
diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c
e0e1b7
index db4a3d061..252bcf647 100644
e0e1b7
--- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c
e0e1b7
+++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_worker.c
e0e1b7
@@ -287,6 +287,7 @@ done:
e0e1b7
     ipa_cldap_respond(ctx, req, &reply);
e0e1b7
 
e0e1b7
     ipa_cldap_free_kvps(&req->kvps);
e0e1b7
+    free(reply.bv_val);
e0e1b7
     free(req);
e0e1b7
     return;
e0e1b7
 }
e0e1b7
-- 
e0e1b7
2.34.1
e0e1b7