[Python-checkins] [3.6] Fixes reference leak (GH-3457) (#3460)
Steve Dower
webhook-mailer at python.org
Fri Sep 8 17:26:29 EDT 2017
https://github.com/python/cpython/commit/ef18b0dab94b00ee233d672d89776539ef236207
commit: ef18b0dab94b00ee233d672d89776539ef236207
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Steve Dower <steve.dower at microsoft.com>
date: 2017-09-08T14:26:27-07:00
summary:
[3.6] Fixes reference leak (GH-3457) (#3460)
(cherry picked from commit af8d6b90723daa943c5cd0a38ee7564790d8687a)
files:
M PC/_findvs.cpp
diff --git a/PC/_findvs.cpp b/PC/_findvs.cpp
index 6c660115963..dd7c1fcb723 100644
--- a/PC/_findvs.cpp
+++ b/PC/_findvs.cpp
@@ -161,18 +161,26 @@ static PyObject *find_all_instances()
PyObject *version = nullptr;
PyObject *path = nullptr;
PyObject *packages = nullptr;
+ PyObject *tuple = nullptr;
if (FAILED(hr = inst->QueryInterface(&inst2)) ||
!(name = get_install_name(inst2)) ||
!(version = get_install_version(inst)) ||
!(path = get_install_path(inst)) ||
!(packages = get_installed_packages(inst2)) ||
- PyList_Append(res, PyTuple_Pack(4, name, version, path, packages)) < 0)
+ !(tuple = PyTuple_Pack(4, name, version, path, packages)) ||
+ PyList_Append(res, tuple) < 0)
goto iter_error;
+ Py_DECREF(tuple);
+ Py_DECREF(packages);
+ Py_DECREF(path);
+ Py_DECREF(version);
+ Py_DECREF(name);
continue;
iter_error:
if (inst2) inst2->Release();
+ Py_XDECREF(tuple);
Py_XDECREF(packages);
Py_XDECREF(path);
Py_XDECREF(version);
More information about the Python-checkins
mailing list