summaryrefslogtreecommitdiffstats
path: root/Modules/syslogmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-12-16 23:52:04 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-12-16 23:52:04 (GMT)
commit6f5b741a4696bc8f331b1d9c77307940528813ff (patch)
treeab7fba466f81b7ef3d9b912e617e7168c4418a8c /Modules/syslogmodule.c
parentb0900e6a217480def244b0b55d718ce705e8e73a (diff)
downloadcpython-6f5b741a4696bc8f331b1d9c77307940528813ff.zip
cpython-6f5b741a4696bc8f331b1d9c77307940528813ff.tar.gz
cpython-6f5b741a4696bc8f331b1d9c77307940528813ff.tar.bz2
SF bug #1086555: refcount problem in syslog
Diffstat (limited to 'Modules/syslogmodule.c')
-rw-r--r--Modules/syslogmodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index 75deb1b..1f2b874 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -57,17 +57,18 @@ syslog_openlog(PyObject * self, PyObject * args)
{
long logopt = 0;
long facility = LOG_USER;
+ PyObject *new_S_ident_o;
-
- Py_XDECREF(S_ident_o);
if (!PyArg_ParseTuple(args,
"S|ll;ident string [, logoption [, facility]]",
- &S_ident_o, &logopt, &facility))
+ &new_S_ident_o, &logopt, &facility))
return NULL;
/* This is needed because openlog() does NOT make a copy
* and syslog() later uses it.. cannot trash it.
*/
+ Py_XDECREF(S_ident_o);
+ S_ident_o = new_S_ident_o;
Py_INCREF(S_ident_o);
openlog(PyString_AsString(S_ident_o), logopt, facility);