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
552be9b2
Commit
552be9b2
authored
Feb 15, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Plain Diff
Issue #13020: Fix a reference leak when allocating a structsequence object fails.
Patch by Suman Saha.
parents
15af7b4a
4b3c7846
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
Misc/NEWS
Misc/NEWS
+3
-0
Objects/structseq.c
Objects/structseq.c
+13
-12
No files found.
Misc/NEWS
View file @
552be9b2
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1?
Core and Builtins
-----------------
- Issue #13020: Fix a reference leak when allocating a structsequence object
fails. Patch by Suman Saha.
- Issue #13777: Add PF_SYSTEM sockets on OS X.
Patch by Michael Goderbauer.
...
...
Objects/structseq.c
View file @
552be9b2
...
...
@@ -103,32 +103,33 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if
(
min_len
!=
max_len
)
{
if
(
len
<
min_len
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.500s() takes an at least %zd-sequence (%zd-sequence given)"
,
type
->
tp_name
,
min_len
,
len
);
Py_DECREF
(
arg
);
return
NULL
;
"%.500s() takes an at least %zd-sequence (%zd-sequence given)"
,
type
->
tp_name
,
min_len
,
len
);
Py_DECREF
(
arg
);
return
NULL
;
}
if
(
len
>
max_len
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.500s() takes an at most %zd-sequence (%zd-sequence given)"
,
type
->
tp_name
,
max_len
,
len
);
Py_DECREF
(
arg
);
return
NULL
;
"%.500s() takes an at most %zd-sequence (%zd-sequence given)"
,
type
->
tp_name
,
max_len
,
len
);
Py_DECREF
(
arg
);
return
NULL
;
}
}
else
{
if
(
len
!=
min_len
)
{
PyErr_Format
(
PyExc_TypeError
,
"%.500s() takes a %zd-sequence (%zd-sequence given)"
,
type
->
tp_name
,
min_len
,
len
);
Py_DECREF
(
arg
);
return
NULL
;
"%.500s() takes a %zd-sequence (%zd-sequence given)"
,
type
->
tp_name
,
min_len
,
len
);
Py_DECREF
(
arg
);
return
NULL
;
}
}
res
=
(
PyStructSequence
*
)
PyStructSequence_New
(
type
);
if
(
res
==
NULL
)
{
Py_DECREF
(
arg
);
return
NULL
;
}
for
(
i
=
0
;
i
<
len
;
++
i
)
{
...
...
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