summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-10-11 05:28:08 (GMT)
committerGitHub <noreply@github.com>2018-10-11 05:28:08 (GMT)
commit1a23abed1340c44e0296d9963487443f63aea225 (patch)
treec1996225eae131dc3053f9c984ab82d2fe77d025 /Python/symtable.c
parentf543e18708efb04ed3a0b78c8dc31fbb1404ac7d (diff)
downloadcpython-1a23abed1340c44e0296d9963487443f63aea225.zip
cpython-1a23abed1340c44e0296d9963487443f63aea225.tar.gz
cpython-1a23abed1340c44e0296d9963487443f63aea225.tar.bz2
Fix a possible decref of a borrowed reference in symtable.c. (GH-9786)
(cherry picked from commit fc439d20de32b0ebccca79a96e31f83b85ec4eaf) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 6165cfe..90b07ef 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -628,8 +628,10 @@ update_symbols(PyObject *symbols, PyObject *scopes,
return 0;
itr = PyObject_GetIter(free);
- if (!itr)
- goto error;
+ if (itr == NULL) {
+ Py_DECREF(v_free);
+ return 0;
+ }
while ((name = PyIter_Next(itr))) {
v = PyDict_GetItem(symbols, name);