summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2006-03-07 15:39:21 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2006-03-07 15:39:21 (GMT)
commit4af5c8cee4885df70884a58e2e74c48984bbe7c2 (patch)
treef4c33e559962940576f84b61f760a1b27a3b8618 /Python/traceback.c
parentef1701f7d3a57427c1289bef32227a7aaac7905a (diff)
downloadcpython-4af5c8cee4885df70884a58e2e74c48984bbe7c2.zip
cpython-4af5c8cee4885df70884a58e2e74c48984bbe7c2.tar.gz
cpython-4af5c8cee4885df70884a58e2e74c48984bbe7c2.tar.bz2
SF #1444030: Fix several potential defects found by Coverity.
(reviewed by Neal Norwitz)
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index 7b83d8b..6c11cf5 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -185,8 +185,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 {