diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-20 04:08:12 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-20 04:08:12 (GMT) |
commit | d1e0ef68fb3b92b4c54cbb614d521e28078f4788 (patch) | |
tree | 7a2e91846225237b2a103198ca539dc2afebdf79 /Modules/posixmodule.c | |
parent | c3264e50e741ccac19f949ff87803f576b5a4918 (diff) | |
download | cpython-d1e0ef68fb3b92b4c54cbb614d521e28078f4788.zip cpython-d1e0ef68fb3b92b4c54cbb614d521e28078f4788.tar.gz cpython-d1e0ef68fb3b92b4c54cbb614d521e28078f4788.tar.bz2 |
SF #1445431, fix some leaks in error conditions.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 1fbc353..116b66b 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6396,15 +6396,16 @@ posix_tmpnam(PyObject *self, PyObject *noargs) name = tmpnam(buffer); #endif if (name == NULL) { - PyErr_SetObject(PyExc_OSError, - Py_BuildValue("is", 0, + PyObject *err = Py_BuildValue("is", 0, #ifdef USE_TMPNAM_R "unexpected NULL from tmpnam_r" #else "unexpected NULL from tmpnam" #endif - )); - return NULL; + ); + PyErr_SetObject(PyExc_OSError, err); + Py_XDECREF(err); + return NULL; } return PyString_FromString(buffer); } |