diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-07-26 11:56:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 11:56:04 (GMT) |
commit | 2f9e47c026795bb58401dfe28d66e83793592e57 (patch) | |
tree | e995dd1fa88b9a1f6e42db01fd749c871e062262 /Modules | |
parent | a4fd732155771d7bedd7cd7e372b2387e93d1dbc (diff) | |
download | cpython-2f9e47c026795bb58401dfe28d66e83793592e57.zip cpython-2f9e47c026795bb58401dfe28d66e83793592e57.tar.gz cpython-2f9e47c026795bb58401dfe28d66e83793592e57.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.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 95e5eff..729986a 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; } } |