Skip to content

Commit 6c73d1e

Browse files
committed
Check for NULL
1 parent 2319a43 commit 6c73d1e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bson/_cbsonmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,9 @@ void handle_invalid_doc_error(PyObject* dict) {
16641664
goto cleanup;
16651665
}
16661666
PyObject *new_msg = PyUnicode_FromFormat("Invalid document: %s", msg_utf8);
1667+
if (new_msg == NULL) {
1668+
goto cleanup;
1669+
}
16671670
// Add doc to the error instance as a property.
16681671
PyObject *new_evalue = PyObject_CallFunctionObjArgs(InvalidDocument, new_msg, dict, NULL);
16691672
Py_DECREF(evalue);

0 commit comments

Comments
 (0)