summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2006-03-07 15:59:09 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2006-03-07 15:59:09 (GMT)
commit361cd4bd6c9c2d56ed154922e016c47d4bee9482 (patch)
tree52d919a372188402f40d1eb5a159a4a233efccff /Python
parent82735da0165cc8b0b080d7e28d4123c3168c4cf7 (diff)
downloadcpython-361cd4bd6c9c2d56ed154922e016c47d4bee9482.zip
cpython-361cd4bd6c9c2d56ed154922e016c47d4bee9482.tar.gz
cpython-361cd4bd6c9c2d56ed154922e016c47d4bee9482.tar.bz2
Backport r42894: SF #1444030 Fix several potential defects found
by Coverity.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c5
-rw-r--r--Python/traceback.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 474d89b..d270c92 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3407,8 +3407,11 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
{
PyObject *result;
- if (arg == NULL)
+ if (arg == NULL) {
arg = PyTuple_New(0);
+ if (arg == NULL)
+ return NULL;
+ }
else if (!PyTuple_Check(arg)) {
PyErr_SetString(PyExc_TypeError,
"argument list must be a tuple");
diff --git a/Python/traceback.c b/Python/traceback.c
index f40cfb4..cb568da 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -184,8 +184,12 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
}
PyOS_snprintf(linebuf, sizeof(linebuf), FMT, filename, lineno, name);
err = PyFile_WriteString(linebuf, f);
- if (xfp == NULL || err != 0)
+ if (xfp == NULL)
return err;
+ else if (err != 0) {
+ fclose(xfp);
+ return err;
+ }
for (i = 0; i < lineno; i++) {
char* pLastChar = &linebuf[sizeof(linebuf)-2];
do {