util: address memory leak in attr_as_bool()

The xmlChar* value is never xmlFree()'d before returning.

Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
This commit is contained in:
Igor Opaniuk
2025-11-04 13:07:23 +01:00
parent 8c0fd741ee
commit dd7fb4f002

5
util.c
View File

@@ -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;
}
/***