From 2dab66694bb72ee222a44c49c669e9f5adc024f0 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Thu, 29 Feb 2024 00:51:42 +0100 Subject: Load audio file with miniaudio instead of dr_libs; Fix null dereference when loading empty sampler --- source/kit/xml.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'source/kit/xml.c') diff --git a/source/kit/xml.c b/source/kit/xml.c index 8d22bf3..0d8378c 100644 --- a/source/kit/xml.c +++ b/source/kit/xml.c @@ -22,7 +22,7 @@ static s32 kit_xml_alloc_and_unescape_(str_builder_t *dst, str_t str, DA_INIT(*dst, str.size, alloc); if (dst->size != str.size) - return KIT_ERROR_BAD_ALLOC; + return KIT_ERROR_OUT_OF_MEMORY; dst->size = 0; @@ -127,7 +127,8 @@ static ib_token_t kit_xml_parse_text_(ib_token_t begin, assert(dst->size == last.size); if (dst->size != last.size) - last.status |= KIT_ERROR_BAD_ALLOC; + last.status |= KIT_ERROR_OUT_OF_MEMORY +; else if (last.size > 0) memcpy(dst->values, ib_str(last).values, last.size); @@ -147,7 +148,8 @@ static ib_token_t kit_xml_parse_text_(ib_token_t begin, assert(dst->size == n + next_text.size); if (dst->size != n + next_text.size) - next_text.status |= KIT_ERROR_BAD_ALLOC; + next_text.status |= KIT_ERROR_OUT_OF_MEMORY + ; else memcpy(dst->values + n, ib_str(next_text).values, ib_str(next_text).size); @@ -246,7 +248,8 @@ static kit_xml_intermediate_t kit_xml_parse_buf_( assert(tag.properties.size == n + 1); if (tag.properties.size != n + 1) { - last.status |= KIT_ERROR_BAD_ALLOC; + last.status |= KIT_ERROR_OUT_OF_MEMORY + ; DA_DESTROY(tag.properties); } else { last.status |= kit_xml_alloc_and_unescape_( @@ -303,7 +306,8 @@ static kit_xml_intermediate_t kit_xml_parse_buf_( assert(res.tags.size == n + 1); if (res.tags.size != n + 1) { - last.status |= KIT_ERROR_BAD_ALLOC; + last.status |= KIT_ERROR_OUT_OF_MEMORY + ; xml_destroy(&tag); } else { last.status |= kit_xml_alloc_and_unescape_( @@ -390,7 +394,7 @@ static s32 kit_xml_append_text_(str_builder_t *buf, xml_t *xml) { assert(buf->size == n + xml->text.size); if (buf->size != n + xml->text.size) - return KIT_ERROR_BAD_ALLOC; + return KIT_ERROR_OUT_OF_MEMORY; if (xml->text.size > 0) memcpy(buf->values + n, xml->text.values, xml->text.size); @@ -410,7 +414,8 @@ static s32 kit_xml_append_text_(str_builder_t *buf, xml_t *xml) { assert(buf->size == n + tail.size); if (buf->size != n + tail.size) - return KIT_ERROR_BAD_ALLOC; + return KIT_ERROR_OUT_OF_MEMORY +; if (tail.size > 0) memcpy(buf->values + n, tail.values, tail.size); -- cgit v1.2.3