[Patches] [ python-Patches-1552731 ] Fix error checks and leaks in setobject.c
SourceForge.net
noreply at sourceforge.net
Wed Sep 6 09:09:12 CEST 2006
Patches item #1552731, was opened at 2006-09-05 14:47
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1552731&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
Status: Open
Resolution: Accepted
Priority: 7
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Fix error checks and leaks in setobject.c
Initial Comment:
Check return values for errors.
Fix refcounts on the error returns;
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2006-09-06 07:09
Message:
Logged In: YES
user_id=849994
That misses the possibility of set_contains_key's return
value being 0.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2006-09-06 07:04
Message:
Logged In: YES
user_id=33168
This is fine. Though I wonder if hunks like this:
- if (set_contains_key(so, key)) {
+ int rv = set_contains_key(so, key);
+ if (rv == -1) {
+ Py_DECREF(it);
+ Py_DECREF(result);
+ Py_DECREF(key);
+ return NULL;
+ }
+ if (rv) {
if (set_add_key(result, key) == -1) {
would be clearer (to me at least) more like:
if (set_contains_key(so, key) == -1 ||
set_add_key(result, key) == -1) {
That ensures the cleanup is the same. There are several
similar hunks.
----------------------------------------------------------------------
Comment By: Georg Brandl (gbrandl)
Date: 2006-09-06 06:54
Message:
Logged In: YES
user_id=849994
Shouldn't this go into 2.5 final?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1552731&group_id=5470
More information about the Patches
mailing list