Skip to content

Commit 6ecd084

Browse files
Merge pull request #305 from Distributive-Network/philippe/fix-298
Philippe/fix 298
2 parents b56503c + 51634fb commit 6ecd084

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/StrType.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
133133
uint16_t *chars = PY_UNICODE_OBJECT_DATA_UCS2(pyObject);
134134
size_t length = PY_UNICODE_OBJECT_LENGTH(pyObject);
135135

136-
uint32_t ucs4String[length];
136+
uint32_t *ucs4String = new uint32_t[length];
137137
size_t ucs4Length = 0;
138138

139139
for (size_t i = 0; i < length; i++, ucs4Length++) {
@@ -152,5 +152,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
152152
}
153153
}
154154

155-
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
155+
PyObject *ret = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
156+
delete[] ucs4String;
157+
return ret;
156158
}

0 commit comments

Comments
 (0)