Compare commits

...

2 commits

Author SHA1 Message Date
8987802437 Merge pull request 'Fix LMDB use-after-free' (#53) from lda/Cytoplasm:fix-deadlock into master
Some checks failed
Compile Cytoplasm / Compile Cytoplasm (x86, alpine-v3.19) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86, debian-v12.4) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86, freebsd-v14.0) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86, netbsd-v9.3) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86_64, alpine-v3.19) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86_64, debian-v12.4) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86_64, freebsd-v14.0) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86_64, netbsd-v9.3) (push) Has been cancelled
Compile Cytoplasm / Compile Cytoplasm (x86_64, openbsd-v7.4) (push) Has been cancelled
Reviewed-on: #53
2024-09-13 20:11:12 -04:00
LDA
9fed42d2ac [FIX] Fix LMDB use-after-free 2024-09-09 13:05:30 +02:00

View file

@ -293,6 +293,7 @@ LMDBUnlock(Db *d, DbRef *r)
Stream *stream; Stream *stream;
MDB_val key, val; MDB_val key, val;
bool ret = true; bool ret = true;
DbHint hint = r ? r->hint : 0;
if (!d || !r) if (!d || !r)
{ {
@ -324,7 +325,7 @@ LMDBUnlock(Db *d, DbRef *r)
{ {
free(val.mv_data); free(val.mv_data);
} }
if (ret && r->hint == DB_HINT_WRITE) if (ret && hint == DB_HINT_WRITE)
{ {
pthread_mutex_unlock(&d->lock); pthread_mutex_unlock(&d->lock);
} }