We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b56503c + 51634fb commit 6ecd084Copy full SHA for 6ecd084
src/StrType.cc
@@ -133,7 +133,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
133
uint16_t *chars = PY_UNICODE_OBJECT_DATA_UCS2(pyObject);
134
size_t length = PY_UNICODE_OBJECT_LENGTH(pyObject);
135
136
- uint32_t ucs4String[length];
+ uint32_t *ucs4String = new uint32_t[length];
137
size_t ucs4Length = 0;
138
139
for (size_t i = 0; i < length; i++, ucs4Length++) {
@@ -152,5 +152,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
152
}
153
154
155
- return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
+ PyObject *ret = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
156
+ delete[] ucs4String;
157
+ return ret;
158
0 commit comments