Commit 3e8c897d authored by Christian Heimes's avatar Christian Heimes

Coverity issue CID #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"
parent 87dcf3d2
...@@ -129,6 +129,8 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name) ...@@ -129,6 +129,8 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
FILE *xfp; FILE *xfp;
char linebuf[2000]; char linebuf[2000];
int i; int i;
char namebuf[MAXPATHLEN+1];
if (filename == NULL || name == NULL) if (filename == NULL || name == NULL)
return -1; return -1;
/* This is needed by Emacs' compile command */ /* This is needed by Emacs' compile command */
...@@ -147,7 +149,6 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name) ...@@ -147,7 +149,6 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
Py_ssize_t _npath = PyList_Size(path); Py_ssize_t _npath = PyList_Size(path);
int npath = Py_SAFE_DOWNCAST(_npath, Py_ssize_t, int); int npath = Py_SAFE_DOWNCAST(_npath, Py_ssize_t, int);
size_t taillen = strlen(tail); size_t taillen = strlen(tail);
char namebuf[MAXPATHLEN+1];
for (i = 0; i < npath; i++) { for (i = 0; i < npath; i++) {
PyObject *v = PyList_GetItem(path, i); PyObject *v = PyList_GetItem(path, i);
if (v == NULL) { if (v == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment