From b93c3b36edaef39ab6aba9d37f068ef0b7b0471b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 29 Jun 2020 20:34:47 +0200 Subject: [PATCH] Prevent more static code analysis warnings --- libretro-common/formats/xml/rxml.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/libretro-common/formats/xml/rxml.c b/libretro-common/formats/xml/rxml.c index de7a9388c1..2954fb5cc0 100644 --- a/libretro-common/formats/xml/rxml.c +++ b/libretro-common/formats/xml/rxml.c @@ -256,11 +256,23 @@ rxml_document_t *rxml_load_document_string(const char *str) case YXML_ATTRSTART: if (attr) - attr = attr->next = (struct rxml_attrib_node*) + { + struct rxml_attrib_node + *new_node = (struct rxml_attrib_node*) calloc(1, sizeof(*attr)); + attr = new_node; + attr->next = new_node ; + } else - attr = node->attrib = (struct rxml_attrib_node*) + { + struct rxml_attrib_node + *new_node = (struct rxml_attrib_node*) calloc(1, sizeof(*attr)); + attr = new_node; + + if (node) + node->attrib = new_node; + } if (attr) {