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