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