##// END OF EJS Templates
osutil: fix leak of stat in makestat when Py_BuildValue fails...
Augie Fackler -
r23962:1f3b94e8 stable
parent child Browse files
Show More
@@ -288,7 +288,7 b' static PyObject *makestat(const struct s'
288
288
289 static PyObject *_listdir(char *path, int pathlen, int keepstat, char *skip)
289 static PyObject *_listdir(char *path, int pathlen, int keepstat, char *skip)
290 {
290 {
291 PyObject *list, *elem, *stat, *ret = NULL;
291 PyObject *list, *elem, *stat = NULL, *ret = NULL;
292 char fullpath[PATH_MAX + 10];
292 char fullpath[PATH_MAX + 10];
293 int kind, err;
293 int kind, err;
294 struct stat st;
294 struct stat st;
@@ -369,6 +369,7 b' static PyObject *_listdir(char *path, in'
369 elem = Py_BuildValue("si", ent->d_name, kind);
369 elem = Py_BuildValue("si", ent->d_name, kind);
370 if (!elem)
370 if (!elem)
371 goto error;
371 goto error;
372 stat = NULL;
372
373
373 PyList_Append(list, elem);
374 PyList_Append(list, elem);
374 Py_DECREF(elem);
375 Py_DECREF(elem);
@@ -379,6 +380,7 b' static PyObject *_listdir(char *path, in'
379
380
380 error:
381 error:
381 Py_DECREF(list);
382 Py_DECREF(list);
383 Py_XDECREF(stat);
382 error_list:
384 error_list:
383 closedir(dir);
385 closedir(dir);
384 error_dir:
386 error_dir:
General Comments 0
You need to be logged in to leave comments. Login now