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 55265ae + 6ecd084 commit c7e6a6cCopy full SHA for c7e6a6c
src/StrType.cc
@@ -136,7 +136,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
136
uint16_t *chars = PY_UNICODE_OBJECT_DATA_UCS2(pyObject);
137
size_t length = PY_UNICODE_OBJECT_LENGTH(pyObject);
138
139
- uint32_t ucs4String[length];
+ uint32_t *ucs4String = new uint32_t[length];
140
size_t ucs4Length = 0;
141
142
for (size_t i = 0; i < length; i++, ucs4Length++) {
@@ -155,5 +155,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
155
}
156
157
158
- return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
+ PyObject *ret = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
159
+ delete[] ucs4String;
160
+ return ret;
161
0 commit comments