Fix bug reported by sanitizer

This commit is contained in:
Kovid Goyal 2023-01-26 09:38:08 +05:30
parent 49e025b565
commit ad4aeaa1a0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -77,7 +77,7 @@ suggest(Dictionary *self, PyObject *args) {
const std::vector<std::string>& word_list = self->handle->suggest(word); const std::vector<std::string>& word_list = self->handle->suggest(word);
ans = PyTuple_New(word_list.size()); ans = PyTuple_New(word_list.size());
if (ans == NULL) PyErr_NoMemory(); if (ans == NULL) return PyErr_NoMemory();
Py_ssize_t i = 0; Py_ssize_t i = 0;
for(auto const& s: word_list) { for(auto const& s: word_list) {
temp = PyUnicode_Decode(s.c_str(), s.size(), self->encoding, "strict"); temp = PyUnicode_Decode(s.c_str(), s.size(), self->encoding, "strict");