Commit 74a307d4 authored by Alexey Izbyshev's avatar Alexey Izbyshev Committed by Serhiy Storchaka

bpo-34435: Add missing NULL check to unicode_encode_ucs1(). (GH-8823)

Reported by Svace static analyzer.
parent 225b0554
......@@ -6813,8 +6813,6 @@ unicode_encode_ucs1(PyObject *unicode,
str = _PyBytesWriter_WriteBytes(&writer, str,
PyBytes_AS_STRING(rep),
PyBytes_GET_SIZE(rep));
if (str == NULL)
goto onError;
}
else {
assert(PyUnicode_Check(rep));
......@@ -6836,6 +6834,9 @@ unicode_encode_ucs1(PyObject *unicode,
PyUnicode_DATA(rep),
PyUnicode_GET_LENGTH(rep));
}
if (str == NULL)
goto onError;
pos = newpos;
Py_CLEAR(rep);
}
......
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