Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HAMANO Tsukasa
OpenLDAP
Commits
9bcc51ef
Commit
9bcc51ef
authored
Sep 21, 2011
by
Howard Chu
Browse files
Only free malloc'd cursors
parent
b9d13a29
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/libmdb/mdb.c
View file @
9bcc51ef
...
...
@@ -790,7 +790,8 @@ struct MDB_cursor {
#define C_INITIALIZED 0x01
/**< cursor has been initialized and is valid */
#define C_EOF 0x02
/**< No more data */
#define C_SUB 0x04
/**< Cursor is a sub-cursor */
#define C_SHADOW 0x08
/**< Cursor is a dup from a parent txn */
#define C_SHADOW 0x08
/**< Cursor is a dup from a parent txn */
#define C_ALLOCD 0x10
/**< Cursor was malloc'd */
/** @} */
unsigned
int
mc_flags
;
/**< @ref mdb_cursor */
MDB_page
*
mc_pg
[
CURSOR_STACK
];
/**< stack of pushed pages */
...
...
@@ -1316,7 +1317,8 @@ mdb_cursor_merge(MDB_txn *txn)
m2
->
mc_ki
[
j
]
=
mc
->
mc_ki
[
j
];
}
}
free
(
mc
);
if
(
mc
->
mc_flags
&
C_ALLOCD
)
free
(
mc
);
}
}
}
...
...
@@ -1517,7 +1519,8 @@ mdb_txn_reset0(MDB_txn *txn)
MDB_cursor
*
mc
;
while
((
mc
=
txn
->
mt_cursors
[
i
]))
{
txn
->
mt_cursors
[
i
]
=
mc
->
mc_next
;
free
(
mc
);
if
(
mc
->
mc_flags
&
C_ALLOCD
)
free
(
mc
);
}
}
}
...
...
@@ -4620,6 +4623,7 @@ mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **ret)
mc
->
mc_next
=
txn
->
mt_cursors
[
dbi
];
txn
->
mt_cursors
[
dbi
]
=
mc
;
}
mc
->
mc_flags
|=
C_ALLOCD
;
}
else
{
return
ENOMEM
;
}
...
...
@@ -4664,7 +4668,8 @@ mdb_cursor_close(MDB_cursor *mc)
if
(
*
prev
==
mc
)
*
prev
=
mc
->
mc_next
;
}
free
(
mc
);
if
(
mc
->
mc_flags
&
C_ALLOCD
)
free
(
mc
);
}
}
...
...
Write
Preview
Supports
Markdown
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