From 6a5c67a8f02e6ca6e22541ce4b6b96136c0a53a7 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Sun, 28 May 2006 10:41:29 +0000 Subject: PyErr_Display(), PyErr_WriteUnraisable(): Coverity found a cut-and-paste bug in both: `className` was referenced before being checked for NULL. --- Python/errors.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Python/errors.c') 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("", f); else { -- cgit v1.2.1