We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dd5e156 + c7e6a6c commit 1adaabbCopy full SHA for 1adaabb
src/StrType.cc
@@ -145,7 +145,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
145
uint16_t *chars = PY_UNICODE_OBJECT_DATA_UCS2(pyObject);
146
size_t length = PY_UNICODE_OBJECT_LENGTH(pyObject);
147
148
- uint32_t ucs4String[length];
+ uint32_t *ucs4String = new uint32_t[length];
149
size_t ucs4Length = 0;
150
151
for (size_t i = 0; i < length; i++, ucs4Length++) {
@@ -164,5 +164,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
164
}
165
166
167
- return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
+ PyObject *ret = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
168
+ delete[] ucs4String;
169
+ return ret;
170
0 commit comments