diff options
| author | Tim Peters <tim.peters@gmail.com> | 2006-05-28 10:41:29 +0000 |
|---|---|---|
| committer | Tim Peters <tim.peters@gmail.com> | 2006-05-28 10:41:29 +0000 |
| commit | 6a5c67a8f02e6ca6e22541ce4b6b96136c0a53a7 (patch) | |
| tree | 66d803482bcf5af78f7f28f0fcc31f4b70f19b3c /Python/errors.c | |
| parent | 091a909012f9e42d5e66f36ca102c1e0dda56c89 (diff) | |
| download | cpython-6a5c67a8f02e6ca6e22541ce4b6b96136c0a53a7.tar.gz | |
PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste
bug in both: `className` was referenced before being checked for NULL.
Diffstat (limited to 'Python/errors.c')
| -rw-r--r-- | Python/errors.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/errors.c b/Python/errors.c index f7a1c08f54..a40f073788 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -588,13 +588,16 @@ PyErr_WriteUnraisable(PyObject *obj) if (f != NULL) { PyFile_WriteString("Exception ", f); if (t) { - char* className = PyExceptionClass_Name(t); PyObject* moduleName; - char *dot = strrchr(className, '.'); - if (dot != NULL) - className = dot+1; - moduleName = PyObject_GetAttrString(t, "__module__"); + char* className = PyExceptionClass_Name(t); + if (className != NULL) { + char *dot = strrchr(className, '.'); + if (dot != NULL) + className = dot+1; + } + + moduleName = PyObject_GetAttrString(t, "__module__"); if (moduleName == NULL) PyFile_WriteString("<unknown>", f); else { |
