summaryrefslogtreecommitdiffstats
path: root/Modules/syslogmodule.c
diff options
context:
space:
mode:
authorNoam Cohen <noam@noam.me>2022-07-26 11:34:15 (GMT)
committerGitHub <noreply@github.com>2022-07-26 11:34:15 (GMT)
commitb1f648efc56ff17e18ec2b7402d59a771b305004 (patch)
treeb44b841c41e9ea0d9ecd3d80cbc7d465ac36021d /Modules/syslogmodule.c
parenta5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0 (diff)
downloadcpython-b1f648efc56ff17e18ec2b7402d59a771b305004.zip
cpython-b1f648efc56ff17e18ec2b7402d59a771b305004.tar.gz
cpython-b1f648efc56ff17e18ec2b7402d59a771b305004.tar.bz2
gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails (GH-95264)
Diffstat (limited to 'Modules/syslogmodule.c')
-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;
}
}