mirror of
https://github.com/linux-msm/qdl.git
synced 2026-02-25 13:12:25 -08:00
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:
5
util.c
5
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;
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
Reference in New Issue
Block a user