Commit 098f3c89 authored by David Kahurani's avatar David Kahurani Committed by Alexandre Julliard

xmllite/writer: Handle possible memory allocation failures.

parent 630c38b2
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment