[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#3899) locks in bdb_search()

Full_Name: Hallvard B Furuseth
Version: HEAD
URL: http://folk.uio.no/hbf/OpenLDAP/bdb0727.diff
Submission from: (NULL) (
Submitted by: hallvard

back-bdb/search.c:bdb_search() gets a LOCK_ID() if
!(opinfo && opinfo->boi_txn), but frees it if !opinfo.
A fix is to free it if !ltid instead; that's set
iff (opinfo && opinfo->boi_txn).

Also this is not done before all return statements.

I'll fix (patch attached) if someone confirms; bdb is a bit too
magical for me to meddle with locks like that without asking:-)

I would note that I generally find lock/unlock-code easier to read
with just one unlock per lock, i.e. using goto <unlock; return>
instead of multiple {unlock; return}.  Might have avoided the bug
with not unlocking before each return too.  That's a bigger change
to 6 files, so I'm leaving that alone unless someone says yes.