v0.41.2
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