From dd7fb4f0022bc14dbfa7f9bd8a9a116a143d6a23 Mon Sep 17 00:00:00 2001 From: Igor Opaniuk Date: Tue, 4 Nov 2025 13:07:23 +0100 Subject: [PATCH] util: address memory leak in attr_as_bool() The xmlChar* value is never xmlFree()'d before returning. Signed-off-by: Igor Opaniuk --- util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util.c b/util.c index 4b25be7..412e488 100644 --- a/util.c +++ b/util.c @@ -104,6 +104,7 @@ const char *attr_as_string(xmlNode *node, const char *attr, int *errors) bool attr_as_bool(xmlNode *node, const char *attr, int *errors) { xmlChar *value; + bool ret = false; if (!xmlHasProp(node, (xmlChar *)attr)) return false; @@ -114,7 +115,9 @@ bool attr_as_bool(xmlNode *node, const char *attr, int *errors) return false; } - return xmlStrcmp(value, (xmlChar *)"true") == 0; + ret = (xmlStrcmp(value, (xmlChar *)"true") == 0); + xmlFree(value); + return ret; } /***