From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 27 Jul 2022 10:32:02 +0000 (-0700) Subject: gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails (GH-95264) X-Git-Tag: v3.11.0rc1~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9640c4c88cb3b0dfef88d5a00daa3a02eff6347d;p=thirdparty%2FPython%2Fcpython.git 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 --- diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 27b176aeb6db..c409fe968f88 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; } }