From ad4aeaa1a04de7446c5a2395ae611cbe2c3940bd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Jan 2023 09:38:08 +0530 Subject: [PATCH] Fix bug reported by sanitizer --- src/calibre/utils/spell/hunspell_wrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/spell/hunspell_wrapper.cpp b/src/calibre/utils/spell/hunspell_wrapper.cpp index 0a672fd6d6..098b496b5f 100644 --- a/src/calibre/utils/spell/hunspell_wrapper.cpp +++ b/src/calibre/utils/spell/hunspell_wrapper.cpp @@ -77,7 +77,7 @@ suggest(Dictionary *self, PyObject *args) { const std::vector& word_list = self->handle->suggest(word); ans = PyTuple_New(word_list.size()); - if (ans == NULL) PyErr_NoMemory(); + if (ans == NULL) return PyErr_NoMemory(); Py_ssize_t i = 0; for(auto const& s: word_list) { temp = PyUnicode_Decode(s.c_str(), s.size(), self->encoding, "strict");