David Kahurani : xmllite/writer: Handle possible memory allocation failures.
Alexandre Julliard
julliard at winehq.org
Mon Jun 20 16:57:22 CDT 2022
Module: wine
Branch: master
Commit: 098f3c892e3acb63fac7130afce80afd3e7925ba
URL: https://source.winehq.org/git/wine.git/?a=commit;h=098f3c892e3acb63fac7130afce80afd3e7925ba
Author: David Kahurani <k.kahurani at gmail.com>
Date: Mon Jun 20 12:49:46 2022 +0300
xmllite/writer: Handle possible memory allocation failures.
Signed-off-by: David Kahurani <k.kahurani at gmail.com>
---
dlls/xmllite/writer.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c
index 58d9edea059..3f5b3527f23 100644
--- a/dlls/xmllite/writer.c
+++ b/dlls/xmllite/writer.c
@@ -180,6 +180,13 @@ static struct element *alloc_element(xmlwriter *writer, const WCHAR *prefix, con
len += lstrlenW(local);
ret->qname = writer_alloc(writer, (len + 1)*sizeof(WCHAR));
+
+ if (!ret->qname)
+ {
+ writer_free(writer, ret);
+ return NULL;
+ }
+
ret->len = len;
if (prefix)
{
@@ -249,7 +256,8 @@ static WCHAR *writer_strndupW(const xmlwriter *writer, const WCHAR *str, int len
size = (len + 1) * sizeof(WCHAR);
ret = writer_alloc(writer, size);
- memcpy(ret, str, size);
+ if (ret) memcpy(ret, str, size);
+
return ret;
}
More information about the wine-cvs
mailing list