gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails (GH-95264)

(cherry picked from commit b1f648efc5)

Co-authored-by: Noam Cohen <noam@noam.me>
This commit is contained in:
Miss Islington (bot) 2022-07-27 03:32:02 -07:00 committed by GitHub
parent 202311c67a
commit 9640c4c88c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}
}