Skip to content

Commit 2f9e47c

Browse files
gh-95041: Fail syslog.syslog in case inner call to syslog.openlog fails (GH-95264)
(cherry picked from commit b1f648e) Co-authored-by: Noam Cohen <[email protected]>
1 parent a4fd732 commit 2f9e47c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Modules/syslogmodule.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,14 @@ syslog_syslog(PyObject * self, PyObject * args)
191191
*/
192192
if ((openargs = PyTuple_New(0))) {
193193
PyObject *openlog_ret = syslog_openlog(self, openargs, NULL);
194-
Py_XDECREF(openlog_ret);
195194
Py_DECREF(openargs);
195+
if (openlog_ret == NULL) {
196+
return NULL;
197+
}
198+
Py_DECREF(openlog_ret);
199+
}
200+
else {
201+
return NULL;
196202
}
197203
}
198204

0 commit comments

Comments
 (0)