(libretro-common) Prevent more static code analysis warnings

This commit is contained in:
twinaphex 2020-06-29 20:31:14 +02:00
parent f83f0b2d44
commit 5cfc4defc6
2 changed files with 18 additions and 9 deletions

View File

@ -256,13 +256,18 @@ rxml_document_t *rxml_load_document_string(const char *str)
case YXML_ATTRSTART:
if (attr)
attr = attr->next = (struct rxml_attrib_node*)calloc(1, sizeof(*attr));
attr = attr->next = (struct rxml_attrib_node*)
calloc(1, sizeof(*attr));
else
attr = node->attrib = (struct rxml_attrib_node*)calloc(1, sizeof(*attr));
attr = node->attrib = (struct rxml_attrib_node*)
calloc(1, sizeof(*attr));
if (attr->attrib)
free(attr->attrib);
attr->attrib = strdup(x.attr);
if (attr)
{
if (attr->attrib)
free(attr->attrib);
attr->attrib = strdup(x.attr);
}
valptr = buf->val;
break;
@ -280,9 +285,12 @@ rxml_document_t *rxml_load_document_string(const char *str)
{
*valptr = '\0';
if (attr->value)
free(attr->value);
attr->value = strdup(buf->val);
if (attr)
{
if (attr->value)
free(attr->value);
attr->value = strdup(buf->val);
}
valptr = buf->val;
}

View File

@ -549,7 +549,8 @@ int64_t filestream_read_file(const char *path, void **buf, int64_t *len)
error:
if (file)
filestream_close(file);
if (filestream_close(file) != 0)
free(file);
if (content_buf)
free(content_buf);
if (len)