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