Numerous instances of :
(1) Event returned_pointer:
Pointer "tmp" returned by "xmlNewChild(root, NULL,
(xmlChar *)"currentMemory", (xmlChar *)string)" is never used.
482 tmp = xmlNewChild(root,
483 NULL,
...
Resolved by adding "if (tmp == NULL) return XML_ERROR;"
---
libxkutil/xmlgen.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index 94fb7d3..6302b60 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -483,6 +483,8 @@ static const char *mem_xml(xmlNodePtr root, struct domain *dominfo)
NULL,
BAD_CAST "currentMemory",
BAD_CAST string);
+ if (tmp == NULL)
+ return XML_ERROR;
free(string);
tmp = NULL;
@@ -650,12 +652,16 @@ static char *system_xml(xmlNodePtr root, struct domain *domain)
xmlNodePtr tmp;
tmp = xmlNewChild(root, NULL, BAD_CAST "name", BAD_CAST
domain->name);
+ if (tmp == NULL)
+ return XML_ERROR;
if (domain->bootloader) {
tmp = xmlNewChild(root,
NULL,
BAD_CAST "bootloader",
BAD_CAST domain->bootloader);
+ if (tmp == NULL)
+ return XML_ERROR;
}
if (domain->bootloader_args) {
@@ -663,25 +669,35 @@ static char *system_xml(xmlNodePtr root, struct domain *domain)
NULL,
BAD_CAST "bootloader_args",
BAD_CAST domain->bootloader_args);
+ if (tmp == NULL)
+ return XML_ERROR;
}
tmp = xmlNewChild(root,
NULL,
BAD_CAST "on_poweroff",
BAD_CAST vssd_recovery_action_str(domain->on_poweroff));
+ if (tmp == NULL)
+ return XML_ERROR;
tmp = xmlNewChild(root,
NULL,
BAD_CAST "on_crash",
BAD_CAST vssd_recovery_action_str(domain->on_crash));
+ if (tmp == NULL)
+ return XML_ERROR;
tmp = xmlNewChild(root,
NULL,
BAD_CAST "uuid",
BAD_CAST domain->uuid);
+ if (tmp == NULL)
+ return XML_ERROR;
if (domain->clock != NULL) {
tmp = xmlNewChild(root, NULL, BAD_CAST "clock", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
xmlNewProp(tmp, BAD_CAST "offset", BAD_CAST domain->clock);
}
--
1.8.1.4