Skip to content

Commit 1adaabb

Browse files
Merge branch 'caleb/fix/this' into philippe/pyTypeFactory-cleanup
2 parents dd5e156 + c7e6a6c commit 1adaabb

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
@@ -145,7 +145,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
145145
uint16_t *chars = PY_UNICODE_OBJECT_DATA_UCS2(pyObject);
146146
size_t length = PY_UNICODE_OBJECT_LENGTH(pyObject);
147147

148-
uint32_t ucs4String[length];
148+
uint32_t *ucs4String = new uint32_t[length];
149149
size_t ucs4Length = 0;
150150

151151
for (size_t i = 0; i < length; i++, ucs4Length++) {
@@ -164,5 +164,7 @@ PyObject *StrType::asUCS4(PyObject *pyObject) {
164164
}
165165
}
166166

167-
return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
167+
PyObject *ret = PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, ucs4String, ucs4Length);
168+
delete[] ucs4String;
169+
return ret;
168170
}

0 commit comments

Comments
 (0)