diff options
author | Hye-Shik Chang <hyeshik@gmail.com> | 2006-03-07 15:39:21 +0000 |
---|---|---|
committer | Hye-Shik Chang <hyeshik@gmail.com> | 2006-03-07 15:39:21 +0000 |
commit | dfc47a8b931a2e519e292278fb641e7f6b2d47e7 (patch) | |
tree | 9c9de63bbe4621760fad9853fd171fb3d364d227 /Python/traceback.c | |
parent | 3d14e6b4f53a9f54a49c44660e8121d0b84511ed (diff) | |
download | cpython-dfc47a8b931a2e519e292278fb641e7f6b2d47e7.tar.gz |
SF #1444030: Fix several potential defects found by Coverity.
(reviewed by Neal Norwitz)
Diffstat (limited to 'Python/traceback.c')
-rw-r--r-- | Python/traceback.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index 7b83d8b02d..6c11cf5274 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 { |