Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 052bcb8

Browse filesBrowse files
author
Anselm Kruis
committed
Issue python#117: fix a reference leak in stackless.threads
Fix two reference leaks in the C-implementation of stackless.threads. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from 0ed22581e9fc255195d9116446ab9b20bcf99ac8)
1 parent 0ad0eac commit 052bcb8
Copy full SHA for 052bcb8

File tree

2 files changed

+11
-3
lines changed
Filter options

2 files changed

+11
-3
lines changed

‎Stackless/changelog.txt

Copy file name to clipboardExpand all lines: Stackless/changelog.txt
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ What's New in Stackless 3.X.X?
2121
- https://bitbucket.org/stackless-dev/stackless/issues/117
2222
Fix various reference leaks:
2323
- Leak of a reference to Py_None in generator.throw()
24-
24+
- Leak of a reference to the thread-id of every thread returned by stackless.threads
25+
2526
Additionally this change brings the handling of caught exceptions more in
2627
line with C-Python.
2728

‎Stackless/module/stacklessmodule.c

Copy file name to clipboardExpand all lines: Stackless/module/stacklessmodule.c
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,9 +1524,16 @@ slpmodule_getthreads(PyObject *self)
15241524

15251525
for (ts = interp->tstate_head; ts != NULL; ts = ts->next) {
15261526
PyObject *id = PyLong_FromLong(ts->thread_id);
1527-
1528-
if (id == NULL || PyList_Append(lis, id))
1527+
if (id == NULL) {
1528+
Py_DECREF(lis);
1529+
return NULL;
1530+
}
1531+
if (PyList_Append(lis, id)) {
1532+
Py_DECREF(lis);
1533+
Py_DECREF(id);
15291534
return NULL;
1535+
}
1536+
Py_DECREF(id);
15301537
}
15311538
PyList_Reverse(lis);
15321539
return lis;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.