[PATCH 1/2] utils: Fix memory leak of base64 decoded XML entries

Benjamin Berg benjamin at sipsolutions.net
Fri Nov 21 05:46:42 PST 2025


From: Benjamin Berg <benjamin.berg at intel.com>

A copy is created to append a NUL byte, however the original base64
decoded string was not released.

Fixes: 2cb8f967896d ("HS 2.0R2: Add wrapper functions for libxml2")
Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
 src/utils/xml_libxml2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/utils/xml_libxml2.c b/src/utils/xml_libxml2.c
index 50630a9254..0aa71d563f 100644
--- a/src/utils/xml_libxml2.c
+++ b/src/utils/xml_libxml2.c
@@ -219,6 +219,7 @@ char * xml_node_get_base64_text(struct xml_node_ctx *ctx, xml_node_t *node,
 	}
 	os_memcpy(txt, ret, len);
 	txt[len] = '\0';
+	os_free(ret);
 	return txt;
 }
 
-- 
2.51.1




More information about the Hostap mailing list