diff Python/traceback.c @ 44739:a3bf0e24b91e legacy-trunk

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"
author Christian Heimes <christian@cheimes.de>
date Fri, 18 Jan 2008 08:47:59 +0000
parents 6620a510e9a9
children 840064802952
line wrap: on
line diff
--- a/Python/traceback.c	Fri Jan 18 08:04:57 2008 +0000
+++ b/Python/traceback.c	Fri Jan 18 08:47:59 2008 +0000
@@ -129,6 +129,8 @@
 	FILE *xfp;
 	char linebuf[2000];
 	int i;
+	char namebuf[MAXPATHLEN+1];
+
 	if (filename == NULL || name == NULL)
 		return -1;
 	/* This is needed by Emacs' compile command */
@@ -147,7 +149,6 @@
 			Py_ssize_t _npath = PyList_Size(path);
 			int npath = Py_SAFE_DOWNCAST(_npath, Py_ssize_t, int);
 			size_t taillen = strlen(tail);
-			char namebuf[MAXPATHLEN+1];
 			for (i = 0; i < npath; i++) {
 				PyObject *v = PyList_GetItem(path, i);
 				if (v == NULL) {