Skip to content

Commit

Permalink
PYTHON-3959 - NULL Initialize PyObjects
Browse files Browse the repository at this point in the history
Missed a few, thanks Jib!
  • Loading branch information
aclark4life committed Sep 19, 2024
1 parent 127ce23 commit f252a7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bson/_cbsonmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2512,8 +2512,8 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
* Wrap any non-InvalidBSON errors in InvalidBSON.
*/
if (PyErr_Occurred()) {
PyObject *etype, *evalue, *etrace;
PyObject *InvalidBSON;
PyObject *etype = NULL, *evalue = NULL, *etrace = NULL;
PyObject *InvalidBSON = NULL;

/*
* Calling _error clears the error state, so fetch it first.
Expand Down Expand Up @@ -2585,8 +2585,8 @@ static int _element_to_dict(PyObject* self, const char* string,
if (!*name) {
/* If NULL is returned then wrap the UnicodeDecodeError
in an InvalidBSON error */
PyObject *etype, *evalue, *etrace;
PyObject *InvalidBSON;
PyObject *etype = NULL, *evalue = NULL, *etrace = NULL;
PyObject *InvalidBSON = NULL;

PyErr_Fetch(&etype, &evalue, &etrace);
if (PyErr_GivenExceptionMatches(etype, PyExc_Exception)) {
Expand Down
2 changes: 1 addition & 1 deletion pymongo/_cmessagemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct module_state {
PyObject* _max_bson_size_str;
PyObject* _max_message_size_str;
PyObject* _max_write_batch_size_str;
PyObject* _max_split_size_str;
PyObject* _max_split_size_str;
};

/* See comments about module initialization in _cbsonmodule.c */
Expand Down

0 comments on commit f252a7c

Please sign in to comment.