summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-19 22:00:50 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-19 22:00:50 +0200
commit82f783595f654b62ce57a7cfb537d23efce7affc (patch)
tree32806d5e2a54c7c47459124c1df15b7e47c8d71b /libs
parent3e85a8e6db1a9c9a7fcf7974a1a0307b2cb145bd (diff)
fix r/w mem leaks
Diffstat (limited to 'libs')
-rw-r--r--libs/xml.c/src/xml.c10
-rw-r--r--libs/xml.c/src/xml.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/libs/xml.c/src/xml.c b/libs/xml.c/src/xml.c
index 0a93e57..6d14213 100644
--- a/libs/xml.c/src/xml.c
+++ b/libs/xml.c/src/xml.c
@@ -820,7 +820,15 @@ exit_failure:
}
-
+bool xml_string_is_valid(uint8_t* buffer, size_t length)
+{
+ struct xml_document* doc = xml_parse_document(buffer, length);
+ if (!doc) {
+ return 0;
+ }
+ xml_document_free(doc, false);
+ return 1;
+}
/**
diff --git a/libs/xml.c/src/xml.h b/libs/xml.c/src/xml.h
index 65a7b9f..ef8d55c 100644
--- a/libs/xml.c/src/xml.h
+++ b/libs/xml.c/src/xml.h
@@ -64,7 +64,7 @@ struct xml_string;
* @return The parsed xml fragment iff parsing was successful, 0 otherwise
*/
struct xml_document* xml_parse_document(uint8_t* buffer, size_t length);
-
+bool xml_string_is_valid(uint8_t* buffer, size_t length);
/**