From 70d4a6af03c07358a2bae9e6a624c2a82467e258 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 29 Oct 2015 08:51:53 +0100 Subject: [PATCH] coverity scan CID 22553: dereference before null check --- src/kernel/xmlreader.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kernel/xmlreader.c b/src/kernel/xmlreader.c index 4f6dbf0c0..63b0c1319 100644 --- a/src/kernel/xmlreader.c +++ b/src/kernel/xmlreader.c @@ -929,12 +929,14 @@ static int parse_resources(xmlDocPtr doc) flags |= RTF_LIMITED; name = xmlGetProp(node, BAD_CAST "name"); - assert(name != NULL); - + if (!name) { + assert(name); + log_error("invalid resource %d has no name", i); + continue; + } rtype = rt_get_or_create((const char *)name); rtype->flags |= flags; - - if (name) xmlFree(name); + xmlFree(name); name = xmlGetProp(node, BAD_CAST "material"); if (name) {