Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
199bf595
Commit
199bf595
authored
Jun 03, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Repaired various leaks due to code leaving references behind in
SetIteration structs.
parent
98b0ee9c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
src/BTrees/MergeTemplate.c
src/BTrees/MergeTemplate.c
+7
-10
src/BTrees/SetOpTemplate.c
src/BTrees/SetOpTemplate.c
+10
-13
No files found.
src/BTrees/MergeTemplate.c
View file @
199bf595
...
...
@@ -12,7 +12,7 @@
****************************************************************************/
#define MERGETEMPLATE_C "$Id: MergeTemplate.c,v 1.1
2 2002/06/02 07:40:20
tim_one Exp $\n"
#define MERGETEMPLATE_C "$Id: MergeTemplate.c,v 1.1
3 2002/06/03 17:21:55
tim_one Exp $\n"
/****************************************************************************
Set operations
...
...
@@ -60,12 +60,9 @@ bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3)
SetIteration
i1
=
{
0
,
0
,
0
},
i2
=
{
0
,
0
,
0
},
i3
=
{
0
,
0
,
0
};
int
cmp12
,
cmp13
,
cmp23
,
mapping
=
0
,
set
;
/* XXX Looks like the various "return NULL;" exits from here on can
* XXX leak references saved away in i1.set, i2.set, i3.set.
*/
if
(
initSetIteration
(
&
i1
,
OBJECT
(
s1
),
0
,
&
mapping
)
<
0
)
return
NULL
;
if
(
initSetIteration
(
&
i2
,
OBJECT
(
s2
),
0
,
&
mapping
)
<
0
)
return
NULL
;
if
(
initSetIteration
(
&
i3
,
OBJECT
(
s3
),
0
,
&
mapping
)
<
0
)
return
NULL
;
if
(
initSetIteration
(
&
i1
,
OBJECT
(
s1
),
0
,
&
mapping
)
<
0
)
goto
err
;
if
(
initSetIteration
(
&
i2
,
OBJECT
(
s2
),
0
,
&
mapping
)
<
0
)
goto
err
;
if
(
initSetIteration
(
&
i3
,
OBJECT
(
s3
),
0
,
&
mapping
)
<
0
)
goto
err
;
set
=
!
mapping
;
...
...
@@ -80,9 +77,9 @@ bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3)
goto
err
;
}
if
(
i1
.
next
(
&
i1
)
<
0
)
return
NULL
;
if
(
i2
.
next
(
&
i2
)
<
0
)
return
NULL
;
if
(
i3
.
next
(
&
i3
)
<
0
)
return
NULL
;
if
(
i1
.
next
(
&
i1
)
<
0
)
goto
err
;
if
(
i2
.
next
(
&
i2
)
<
0
)
goto
err
;
if
(
i3
.
next
(
&
i3
)
<
0
)
goto
err
;
while
(
i1
.
position
>=
0
&&
i2
.
position
>=
0
&&
i3
.
position
>=
0
)
{
...
...
src/BTrees/SetOpTemplate.c
View file @
199bf595
...
...
@@ -16,7 +16,7 @@
Set operations
****************************************************************************/
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.1
7 2002/06/02 07:40:20
tim_one Exp $\n"
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.1
8 2002/06/03 17:21:55
tim_one Exp $\n"
#ifdef INTSET_H
static
int
...
...
@@ -207,8 +207,8 @@ set_operation(PyObject *s1, PyObject *s2,
SetIteration
i1
=
{
0
,
0
,
0
},
i2
=
{
0
,
0
,
0
};
int
cmp
,
merge
=
0
;
if
(
initSetIteration
(
&
i1
,
s1
,
w1
,
&
merge
)
<
0
)
return
NULL
;
if
(
initSetIteration
(
&
i2
,
s2
,
w2
,
&
merge
)
<
0
)
return
NULL
;
if
(
initSetIteration
(
&
i1
,
s1
,
w1
,
&
merge
)
<
0
)
goto
err
;
if
(
initSetIteration
(
&
i2
,
s2
,
w2
,
&
merge
)
<
0
)
goto
err
;
if
(
merge
)
{
...
...
@@ -247,12 +247,12 @@ set_operation(PyObject *s1, PyObject *s2,
goto
err
;
}
if
(
i1
.
next
(
&
i1
)
<
0
)
return
NULL
;
if
(
i2
.
next
(
&
i2
)
<
0
)
return
NULL
;
if
(
i1
.
next
(
&
i1
)
<
0
)
goto
err
;
if
(
i2
.
next
(
&
i2
)
<
0
)
goto
err
;
while
(
i1
.
position
>=
0
&&
i2
.
position
>=
0
)
{
TEST_KEY_SET_OR
(
cmp
,
i1
.
key
,
i2
.
key
)
return
NULL
;
TEST_KEY_SET_OR
(
cmp
,
i1
.
key
,
i2
.
key
)
goto
err
;
if
(
cmp
<
0
)
{
if
(
c1
)
...
...
@@ -489,20 +489,17 @@ multiunion_m(PyObject *ignored, PyObject *args)
/* No cheap way: iterate over set's elements one at a time. */
int
merge
;
/* dummy needed for initSetIteration */
if
(
initSetIteration
(
&
setiter
,
set
,
1
,
&
merge
)
<
0
)
goto
Error
;
if
(
setiter
.
next
(
&
setiter
)
<
0
)
goto
Error
;
if
(
initSetIteration
(
&
setiter
,
set
,
1
,
&
merge
)
<
0
)
goto
Error
;
if
(
setiter
.
next
(
&
setiter
)
<
0
)
goto
Error
;
while
(
setiter
.
position
>=
0
)
{
if
(
result
->
len
>=
result
->
size
&&
Bucket_grow
(
result
,
-
1
,
1
)
<
0
)
goto
Error
;
COPY_KEY
(
result
->
keys
[
result
->
len
],
setiter
.
key
);
++
result
->
len
;
/* We know the key is an int, so no need to incref it. */
if
(
setiter
.
next
(
&
setiter
)
<
0
)
goto
Error
;
if
(
setiter
.
next
(
&
setiter
)
<
0
)
goto
Error
;
}
Py_
X
DECREF
(
setiter
.
set
);
Py_DECREF
(
setiter
.
set
);
setiter
.
set
=
NULL
;
}
Py_DECREF
(
set
);
...
...
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