Mercurial > hg-stable
changeset 23962:1f3b94e8dc40 stable
osutil: fix leak of stat in makestat when Py_BuildValue fails
Spotted with cpychecker.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 27 Jan 2015 10:14:23 -0500 |
parents | bc851e2851b1 |
children | 8f02682ff3b0 |
files | mercurial/osutil.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/osutil.c Tue Jan 27 10:12:55 2015 -0500 +++ b/mercurial/osutil.c Tue Jan 27 10:14:23 2015 -0500 @@ -288,7 +288,7 @@ static PyObject *_listdir(char *path, int pathlen, int keepstat, char *skip) { - PyObject *list, *elem, *stat, *ret = NULL; + PyObject *list, *elem, *stat = NULL, *ret = NULL; char fullpath[PATH_MAX + 10]; int kind, err; struct stat st; @@ -369,6 +369,7 @@ elem = Py_BuildValue("si", ent->d_name, kind); if (!elem) goto error; + stat = NULL; PyList_Append(list, elem); Py_DECREF(elem); @@ -379,6 +380,7 @@ error: Py_DECREF(list); + Py_XDECREF(stat); error_list: closedir(dir); error_dir: