Sitelet https://github.com/erigontech/mdbx-go/releases/tag/v0.41.2
Skip to content

v0.41.2

Choose a tag to compare

@AskAlexSharov AskAlexSharov released this 05 Aug 07:00
· 11 commits to master since this release
3d99453

Patch release on top of v0.41.1. Compile-time only — no runtime behaviour change.

noCopy on the C-handle types

v0.41.1 added Cursor.Open so a Cursor can be embedded by value, which also makes copying one easy to do by accident. A Cursor or Txn owns a raw libmdbx handle, so a copy hands two Go values one handle: closing either frees it while the other still points at it, and the second close is a double free into cgo.

type before now
Env already rejected — holds sync.RWMutex unchanged
Txn unguarded noCopy
Cursor unguarded noCopy

go vet -copylocks now rejects the copy:

assignment copies lock value to b: mdbx.Cursor contains mdbx.noCopy

Embedding by value — the reason Open exists — is unaffected; noCopy bars copying a value, not holding one. sizeof(Cursor) is unchanged at 16 bytes.

Full changelog: v0.41.1...v0.41.2