From f252a7c48ea448f03ffc521211fffb96c348dc94 Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Wed, 18 Sep 2024 12:48:59 -0400 Subject: [PATCH] PYTHON-3959 - NULL Initialize PyObjects Missed a few, thanks Jib! --- bson/_cbsonmodule.c | 8 ++++---- pymongo/_cmessagemodule.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c index b706c35e30..51ad13a008 100644 --- a/bson/_cbsonmodule.c +++ b/bson/_cbsonmodule.c @@ -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. @@ -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)) { diff --git a/pymongo/_cmessagemodule.c b/pymongo/_cmessagemodule.c index 9c8fb550f2..b5adbeec32 100644 --- a/pymongo/_cmessagemodule.c +++ b/pymongo/_cmessagemodule.c @@ -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 */