mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
builtin_map(): A better fix for the previous leak plug (remember
PyList_Append steals a reference even if it fails). builtin_filter(): Had the same leak problem as builtin_map().
This commit is contained in:
parent
c9bda41a21
commit
fa77e09dd0
1 changed files with 6 additions and 3 deletions
|
@ -232,8 +232,10 @@ builtin_filter(self, args)
|
||||||
goto Fail_1;
|
goto Fail_1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
int status = PyList_Append(result, item);
|
||||||
j++;
|
j++;
|
||||||
if (PyList_Append(result, item) < 0)
|
Py_DECREF(item);
|
||||||
|
if (status < 0)
|
||||||
goto Fail_1;
|
goto Fail_1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -901,9 +903,10 @@ builtin_map(self, args)
|
||||||
goto Fail_1;
|
goto Fail_1;
|
||||||
}
|
}
|
||||||
if (i >= len) {
|
if (i >= len) {
|
||||||
if (PyList_Append(result, value) < 0)
|
int status = PyList_Append(result, value);
|
||||||
goto Fail_1;
|
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
|
if (status < 0)
|
||||||
|
goto Fail_1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (PyList_SetItem(result, i, value) < 0)
|
if (PyList_SetItem(result, i, value) < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue