##// END OF EJS Templates
osutil: fix memory leak of PyBytes of path in statfiles...
Augie Fackler -
r23966:2d2c0a8e stable
parent child Browse files
Show More
@@ -410,17 +410,22 b' static PyObject *statfiles(PyObject *sel'
410 410 return NULL;
411 411
412 412 for (i = 0; i < count; i++) {
413 PyObject *stat;
413 PyObject *stat, *pypath;
414 414 struct stat st;
415 415 int ret, kind;
416 416 char *path;
417 417
418 path = PyString_AsString(PySequence_GetItem(names, i));
418 pypath = PySequence_GetItem(names, i);
419 if (!pypath)
420 return NULL;
421 path = PyString_AsString(pypath);
419 422 if (path == NULL) {
423 Py_DECREF(pypath);
420 424 PyErr_SetString(PyExc_TypeError, "not a string");
421 425 goto bail;
422 426 }
423 427 ret = lstat(path, &st);
428 Py_DECREF(pypath);
424 429 kind = st.st_mode & S_IFMT;
425 430 if (ret != -1 && (kind == S_IFREG || kind == S_IFLNK)) {
426 431 stat = makestat(&st);
General Comments 0
You need to be logged in to leave comments. Login now