Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e8c897

Browse files
committed
Coverity issue CID python#169
local_ptr_assign_local: Assigning address of stack variable "namebuf" to pointer "filename" out_of_scope: Variable "namebuf" goes out of scope use_invalid: Used "filename" pointing to out-of-scope variable "namebuf"
1 parent 87dcf3d commit 3e8c897

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Python/traceback.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
129129
FILE *xfp;
130130
char linebuf[2000];
131131
int i;
132+
char namebuf[MAXPATHLEN+1];
133+
132134
if (filename == NULL || name == NULL)
133135
return -1;
134136
/* This is needed by Emacs' compile command */
@@ -147,7 +149,6 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
147149
Py_ssize_t _npath = PyList_Size(path);
148150
int npath = Py_SAFE_DOWNCAST(_npath, Py_ssize_t, int);
149151
size_t taillen = strlen(tail);
150-
char namebuf[MAXPATHLEN+1];
151152
for (i = 0; i < npath; i++) {
152153
PyObject *v = PyList_GetItem(path, i);
153154
if (v == NULL) {

0 commit comments

Comments
 (0)