Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ea370a9e
Commit
ea370a9e
authored
Feb 23, 2010
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6544: fix refleak in kqueue, occurring in certain error conditions.
parent
6ae19ade
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
Misc/NEWS
Misc/NEWS
+3
-0
Modules/selectmodule.c
Modules/selectmodule.c
+15
-16
No files found.
Misc/NEWS
View file @
ea370a9e
...
@@ -58,6 +58,9 @@ Library
...
@@ -58,6 +58,9 @@ Library
Extension Modules
Extension Modules
-----------------
-----------------
- Issue #6544: fix a reference leak in the kqueue implementation's error
handling.
- Stop providing crtassem.h symbols when compiling with Visual Studio 2010, as
- Stop providing crtassem.h symbols when compiling with Visual Studio 2010, as
msvcr100.dll is not a platform assembly anymore.
msvcr100.dll is not a platform assembly anymore.
...
...
Modules/selectmodule.c
View file @
ea370a9e
...
@@ -1236,6 +1236,7 @@ static struct PyMemberDef kqueue_event_members[] = {
...
@@ -1236,6 +1236,7 @@ static struct PyMemberDef kqueue_event_members[] = {
#undef KQ_OFF
#undef KQ_OFF
static
PyObject
*
static
PyObject
*
kqueue_event_repr
(
kqueue_event_Object
*
s
)
kqueue_event_repr
(
kqueue_event_Object
*
s
)
{
{
char
buf
[
1024
];
char
buf
[
1024
];
...
@@ -1521,19 +1522,6 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
...
@@ -1521,19 +1522,6 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
return
NULL
;
return
NULL
;
}
}
if
(
ch
!=
NULL
&&
ch
!=
Py_None
)
{
it
=
PyObject_GetIter
(
ch
);
if
(
it
==
NULL
)
{
PyErr_SetString
(
PyExc_TypeError
,
"changelist is not iterable"
);
return
NULL
;
}
nchanges
=
PyObject_Size
(
ch
);
if
(
nchanges
<
0
)
{
return
NULL
;
}
}
if
(
otimeout
==
Py_None
||
otimeout
==
NULL
)
{
if
(
otimeout
==
Py_None
||
otimeout
==
NULL
)
{
ptimeoutspec
=
NULL
;
ptimeoutspec
=
NULL
;
}
}
...
@@ -1569,11 +1557,22 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
...
@@ -1569,11 +1557,22 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
return
NULL
;
return
NULL
;
}
}
if
(
nchanges
)
{
if
(
ch
!=
NULL
&&
ch
!=
Py_None
)
{
it
=
PyObject_GetIter
(
ch
);
if
(
it
==
NULL
)
{
PyErr_SetString
(
PyExc_TypeError
,
"changelist is not iterable"
);
return
NULL
;
}
nchanges
=
PyObject_Size
(
ch
);
if
(
nchanges
<
0
)
{
goto
error
;
}
chl
=
PyMem_New
(
struct
kevent
,
nchanges
);
chl
=
PyMem_New
(
struct
kevent
,
nchanges
);
if
(
chl
==
NULL
)
{
if
(
chl
==
NULL
)
{
PyErr_NoMemory
();
PyErr_NoMemory
();
return
NULL
;
goto
error
;
}
}
i
=
0
;
i
=
0
;
while
((
ei
=
PyIter_Next
(
it
))
!=
NULL
)
{
while
((
ei
=
PyIter_Next
(
it
))
!=
NULL
)
{
...
@@ -1596,7 +1595,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
...
@@ -1596,7 +1595,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
evl
=
PyMem_New
(
struct
kevent
,
nevents
);
evl
=
PyMem_New
(
struct
kevent
,
nevents
);
if
(
evl
==
NULL
)
{
if
(
evl
==
NULL
)
{
PyErr_NoMemory
();
PyErr_NoMemory
();
return
NULL
;
goto
error
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment