summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-27 10:32:02 (GMT)
committerGitHub <noreply@github.com>2022-07-27 10:32:02 (GMT)
commit9640c4c88cb3b0dfef88d5a00daa3a02eff6347d (patch)
tree4ffc9370090e06624d92b3fb4e028682eb4a5ef8 /Modules
parent202311c67a85888f51ee9ab2df2ac97decbacf56 (diff)
downloadcpython-9640c4c88cb3b0dfef88d5a00daa3a02eff6347d.zip
cpython-9640c4c88cb3b0dfef88d5a00daa3a02eff6347d.tar.gz
cpython-9640c4c88cb3b0dfef88d5a00daa3a02eff6347d.tar.bz2
gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails (GH-95264)
(cherry picked from commit b1f648efc56ff17e18ec2b7402d59a771b305004) Co-authored-by: Noam Cohen <noam@noam.me>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/syslogmodule.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index 27b176a..c409fe9 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -191,8 +191,14 @@ syslog_syslog(PyObject * self, PyObject * args)
*/
if ((openargs = PyTuple_New(0))) {
PyObject *openlog_ret = syslog_openlog(self, openargs, NULL);
- Py_XDECREF(openlog_ret);
Py_DECREF(openargs);
+ if (openlog_ret == NULL) {
+ return NULL;
+ }
+ Py_DECREF(openlog_ret);
+ }
+ else {
+ return NULL;
}
}