Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2133287

Browse files
committed
builtin_map(): Nailed memory leak. PyList_Append() borrows a
reference, so you have to DECREF the appended value. This was a fun one!
1 parent f988e68 commit 2133287

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Python/bltinmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,7 @@ builtin_map(self, args)
903903
if (i >= len) {
904904
if (PyList_Append(result, value) < 0)
905905
goto Fail_1;
906+
Py_DECREF(value);
906907
}
907908
else {
908909
if (PyList_SetItem(result, i, value) < 0)

0 commit comments

Comments
 (0)