Skip to content

Commit c7e6a6c

Browse files
Merge branch 'main' into caleb/fix/this
2 parents 55265ae + 6ecd084 commit c7e6a6c

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
@@ -136,7 +136,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
136136
uint16_t *chars = PY_UNICODE_OBJECT_DATA_UCS2(pyObject);
137137
size_t length = PY_UNICODE_OBJECT_LENGTH(pyObject);
138138

139-
uint32_t ucs4String[length];
139+
uint32_t *ucs4String = new uint32_t[length];
140140
size_t ucs4Length = 0;
141141

142142
for (size_t i = 0; i < length; i++, ucs4Length++) {
@@ -155,5 +155,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
155155
}
156156
}
157157

158-
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
158+
PyObject *ret = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
159+
delete[] ucs4String;
160+
return ret;
159161
}

0 commit comments

Comments
 (0)