[Python-checkins] r60041 - python/trunk/Python/traceback.c

christian.heimes python-checkins at python.org
Fri Jan 18 09:47:59 CET 2008


Author: christian.heimes
Date: Fri Jan 18 09:47:59 2008
New Revision: 60041

Modified:
   python/trunk/Python/traceback.c
Log:
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"

Modified: python/trunk/Python/traceback.c
==============================================================================
--- python/trunk/Python/traceback.c	(original)
+++ python/trunk/Python/traceback.c	Fri Jan 18 09:47:59 2008
@@ -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) {


More information about the Python-checkins mailing list