Commit 01481d0
committed
Fix memory leak in find_path: use Py_BuildValue N format to transfer ownership
Py_BuildValue with O format increments refcount, but the code then set
local pointers to NULL preventing cleanup Py_XDECREF from running,
leaving each returned numpy array with a permanent refcount of 1.
Switched to N format which transfers ownership without incrementing.
Also added missing Py_XDECREF for haplotype_array in AncestorMatcher2.1 parent 34141a5 commit 01481d0
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1501 | 1501 | | |
1502 | 1502 | | |
1503 | 1503 | | |
1504 | | - | |
| 1504 | + | |
1505 | 1505 | | |
1506 | 1506 | | |
1507 | 1507 | | |
| |||
1939 | 1939 | | |
1940 | 1940 | | |
1941 | 1941 | | |
1942 | | - | |
| 1942 | + | |
1943 | 1943 | | |
1944 | 1944 | | |
1945 | 1945 | | |
| |||
1948 | 1948 | | |
1949 | 1949 | | |
1950 | 1950 | | |
| 1951 | + | |
1951 | 1952 | | |
1952 | 1953 | | |
1953 | 1954 | | |
| |||
0 commit comments